keldance
04-17-2003, 04:36 PM
I want my PHP form to be filled out, and I want certain fields to be verified against the MySQL database so that no records/rows can be duplicated upon updating the database with my form information. This is some of the code I tried so far and the only thing that seems to work is that it would verify only the first record but no others:
$row = mysql_fetch_array($result);
while ($row = mysql_fetch_array ($result))
if (($address == $row["address"]) AND ($first_name == $row["first_name"]) AND ($last_name == $row["last_name"]))
{
echo "Sorry. Duplicate entry";
exit;
}
I assumed that I had to make it loop, but I don't even think that's necessary. I've tried mysql_fetch_object also, but to the same effect. Any help would be greatly appreciated.
$row = mysql_fetch_array($result);
while ($row = mysql_fetch_array ($result))
if (($address == $row["address"]) AND ($first_name == $row["first_name"]) AND ($last_name == $row["last_name"]))
{
echo "Sorry. Duplicate entry";
exit;
}
I assumed that I had to make it loop, but I don't even think that's necessary. I've tried mysql_fetch_object also, but to the same effect. Any help would be greatly appreciated.