I am trying to update several rows in the database using mysql statement. My code is as follows. <?php $query = mysql_connect("localhost","root","toor"); mysql_select_db("busticket",$query); $result=mysql_query("Select * from ticket_reservation WHERE validate_status='No'") or die(mysql_error()); while($row=mysql_fetch_array($result)) { echo "<tr><td><input type='checkbox' id='name' name='name[]' value=".$row['id']."</td><td>".$row['userid']."</td><td>".$row['busid']."</td><td>".$row['numberofseats']."</td></tr>"; } echo"<tr><td><input type='submit' name='submit' Value='Validate Tickets'></td></tr>"; if(isset($_POST['submit'])) { if(is_array($_POST['name'])) { $qry = "UPDATE ticket_reservation SET validate_status='Yes' WHERE id IN (".implode(',', $_POST['name']).")"; // echo $qry; // For checking the generated sql statement; can be removed mysql_query($qry); } } ?> </table> </form> My code is not working....

Member Avatar
Member Avatar
+0 forum 1

I want to deploy a database application in C#. I should write a script for creating a database and its tables. The script should work only at install time and setup the database automatically. Or tell me if there is another better way to do that. Actually I wanted to deploy this application on another PC. but connection string and login permissions to the database are causing problem. What I have tried is: 1. Created a database using SQL management studio. 2. copied database file to Client PC. But that did not work. Then I tried adding a new database …

Member Avatar
Member Avatar
+0 forum 1

I am trying to store a value from a selected row from one table into another. My code is as follows. string CustomerID = textBox1.Text; SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["ConString"].ConnectionString); con1.Open(); SqlCommand myCommand = new SqlCommand("Select CustomerID, Name from TableCustomer WHERE (CustomerID like '" + CustomerID+ "')", con1); SqlDataReader rdr = myCommand.ExecuteReader(); while (rdr.Read()) { string Name = rdr["Name"].ToString(); } SqlCommand cmd = new SqlCommand(@"insert into finalTable (AccountNumber, CustomerName) VALUES (@CustomerID, @Name )", con); cmd.ExecuteNonQuery(); con1.Close(); My code is not working properly. All is I want to insert Name and ID of customer in Name field of finalTable. What is …

Member Avatar
Member Avatar
+0 forum 2

The End.