Help-Updating multiple records
| From: | Adriano Manocchia | Date: | Thu, 21 Sep 2000 19:54:16 +0000 |
| Subject: | Help-Updating multiple records | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-17204@lists.php.net to get a copy of this message | ||
I'm not sure if this is more of a PHP or MySQL question, but I'm hoping I can get some
help with it here.
I've got a form being generated from a MySQL query that shows several record names and makes an
input box for each record. After it, there's a submit button. My problem is I can't figure
out how to make it update the field of each of the records shown from the data in the input boxes by
just pressing the one submit button.
Suspect bit of code:
if ($submit) {
$sql="UPDATE samples SET (quality) VALUES ('$quality') WHERE
id='$id'";
$result=mysql_query($sql);
echo "<b>Info added.</b>";
}
elseif ($number) {
echo "<form method='post'>";
$result=mysql_query("SELECT * FROM samples WHERE ordnum='$number'",$db);
while ($myrow = mysql_fetch_array($result))
{
printf("%s <input type='text' name='quality' size='50'
maxlength='100'><br>",$myrow["name"]);
}
echo "<br><input type='submit' name='submit' value='Enter
quality info'><br></form>";
}
So I want to update all the "quality" fields of each of the displayed records. I know this
doesn't work as-is, but if anyone has any ideas of how I might be able to do that with just the
one submit button, I'd love to hear it. Thanks.
Age