hi,
i am looking at how to update multiple records at one time. i can get the data to display in text boxes in a form no problem, but when i make changes and submit form, only the first record is changed with the data from the last feild.
+======================================+
these are the SQL statements i have tried.
+======================================+
$sql = "update tfm_superbuys SET id = \"$id\" WHERE ad_num = \"$ad_num\"";
/*
$sql = "replace tfm_superbuys (id)
WHERE ad_num = \"$ad_num\"";
*/
/*
$sql = "UPDATE tfm_superbuys
Set id$ad_num = \"$id\"
Where ad_num = \"$ad_num\"";
$sql_result = mysql_query($sql)
or die("Couldn't execute query.");
*/
+======================================+
+======================================+
and this is the display code i have tried.
+======================================+
$sql = "SELECT * FROM tfm_superbuys";
$sql_result = mysql_query($sql) or die ("1 Couldn't get records!");
echo "<form method=\"post\" action=\"superbuys_mod2.php\">";
while ($row = mysql_fetch_array($sql_result)) {
$id = $row["id"];
$ad_num = $row["ad_num"];
echo "
<body>
<table>
<tr>
<td width=\"30\"> </td>
<TD width=\"100\" align=\"left\"><font color=\"black\" size=2 face=\"verdana,arial\">Super Buy $ad_num :</font></TD>
<td width=\"80\" align=\"center\"><input type=\"text\" name=\"id$ad_num\" value=http://www.phpbuilder.com/board/archive/index.php/\"$id\" size=3></td>
<input type=\"hidden\" name=\"ad_num\" value=\"$ad_num\">
</tr>
";
}
}
?>
<tr>
<td width="30"> </td>
<td><input type="submit" name="submit" value="Update"></td>
</tr>
</table>
</form>
</body>
+======================================+
i know i am close but just cant seen to get the right combination. any help would be great.
thank you
bill
i am looking at how to update multiple records at one time. i can get the data to display in text boxes in a form no problem, but when i make changes and submit form, only the first record is changed with the data from the last feild.
+======================================+
these are the SQL statements i have tried.
+======================================+
$sql = "update tfm_superbuys SET id = \"$id\" WHERE ad_num = \"$ad_num\"";
/*
$sql = "replace tfm_superbuys (id)
WHERE ad_num = \"$ad_num\"";
*/
/*
$sql = "UPDATE tfm_superbuys
Set id$ad_num = \"$id\"
Where ad_num = \"$ad_num\"";
$sql_result = mysql_query($sql)
or die("Couldn't execute query.");
*/
+======================================+
+======================================+
and this is the display code i have tried.
+======================================+
$sql = "SELECT * FROM tfm_superbuys";
$sql_result = mysql_query($sql) or die ("1 Couldn't get records!");
echo "<form method=\"post\" action=\"superbuys_mod2.php\">";
while ($row = mysql_fetch_array($sql_result)) {
$id = $row["id"];
$ad_num = $row["ad_num"];
echo "
<body>
<table>
<tr>
<td width=\"30\"> </td>
<TD width=\"100\" align=\"left\"><font color=\"black\" size=2 face=\"verdana,arial\">Super Buy $ad_num :</font></TD>
<td width=\"80\" align=\"center\"><input type=\"text\" name=\"id$ad_num\" value=http://www.phpbuilder.com/board/archive/index.php/\"$id\" size=3></td>
<input type=\"hidden\" name=\"ad_num\" value=\"$ad_num\">
</tr>
";
}
}
?>
<tr>
<td width="30"> </td>
<td><input type="submit" name="submit" value="Update"></td>
</tr>
</table>
</form>
</body>
+======================================+
i know i am close but just cant seen to get the right combination. any help would be great.
thank you
bill