I am trying to update several rows in the database using mysql statement. My code is as follows.


 $query = mysql_connect("localhost","root","toor");
 $result=mysql_query("Select * from ticket_reservation WHERE validate_status='No'") or die(mysql_error());
  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>";

        $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


My code is not working....

Re: Update multiple rows using checkboxes 80 80

My code is not working

What exactly is not working? Any errors? If you echo the query, what do you see?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.