city_coder
04-07-2008, 04:24 PM
Hi guys its time for me to ask a question now...
Im trying to update many rows at once. My problem is of course how.
Il show you.
if (mysql_num_rows($insert_query) >0 ) {
//build headers
$header .= "<table border='1' bordercolor='#cccccc' cellspacing='0' cellpadding='3'>";
$header .= "<th bgcolor='#cccccc'>ID</th><th bgcolor='#cccccc'>First Name</th><th bgcolor='#cccccc'>Surname</th><th bgcolor='#cccccc'>Email</th><th bgcolor='#cccccc'>Paid?</th>";
echo $header;
//display information
while($row = mysql_fetch_assoc($insert_query)) {
echo '<tr><td>'.$row['ID'].'</td>';
echo '<td>'.$row['first_name'].'</td>';
echo '<td>'.$row['surname'].'</td>';
echo '<td>'.$row['email'].'</td>';
echo '<td></td></tr>';
}
echo "</table>";
}
So now at the minute i want a tick box to go in that end space. So that requires me to have a form.
That may mean i have a form for each loop, or i have a form for the whole thing and i set the checkbox to be an array and process it that way.
Is it possible to do something like UPDATE SET Edited = 'Y' WHERE ID '1,3,5' ie the numbers that are in the value of the checkbox?
Il be very grateful if anyone can just show me how, i know its completely possible, even if it requires a bit of javascript, but i would still prefer it to be php.
Also i would like to be able to have a checkboxbox at the top that selects all of the other checkboxes, that i know can be done in simple javascript but requires one form right??
Im trying to update many rows at once. My problem is of course how.
Il show you.
if (mysql_num_rows($insert_query) >0 ) {
//build headers
$header .= "<table border='1' bordercolor='#cccccc' cellspacing='0' cellpadding='3'>";
$header .= "<th bgcolor='#cccccc'>ID</th><th bgcolor='#cccccc'>First Name</th><th bgcolor='#cccccc'>Surname</th><th bgcolor='#cccccc'>Email</th><th bgcolor='#cccccc'>Paid?</th>";
echo $header;
//display information
while($row = mysql_fetch_assoc($insert_query)) {
echo '<tr><td>'.$row['ID'].'</td>';
echo '<td>'.$row['first_name'].'</td>';
echo '<td>'.$row['surname'].'</td>';
echo '<td>'.$row['email'].'</td>';
echo '<td></td></tr>';
}
echo "</table>";
}
So now at the minute i want a tick box to go in that end space. So that requires me to have a form.
That may mean i have a form for each loop, or i have a form for the whole thing and i set the checkbox to be an array and process it that way.
Is it possible to do something like UPDATE SET Edited = 'Y' WHERE ID '1,3,5' ie the numbers that are in the value of the checkbox?
Il be very grateful if anyone can just show me how, i know its completely possible, even if it requires a bit of javascript, but i would still prefer it to be php.
Also i would like to be able to have a checkboxbox at the top that selects all of the other checkboxes, that i know can be done in simple javascript but requires one form right??