MySQL's UPDATE & PHP
| From: | afrodriguez at att dot net | Date: | Sat, 29 Sep 2001 20:28:17 +0000 |
| Subject: | MySQL's UPDATE & PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-69316@lists.php.net to get a copy of this message | ||
A previous script correctly creates a record and INSERTS
the user name and password.
However, when I run the following script, the username
and the first_name are displayed correctly but the
first_name is not UPDATED in the record. Why?
<?php
// file: "root/reg/add_4.php", updated: 09/29/01
$connection=@mysql_connect("localhost","afr","xxx") or
die ("No connection!");
$db=@mysql_select_db("sbwresearch",$connection) or die
("No database!");
// to see if parameters are being passed to this script
echo "Ok!";
echo "<br>";
echo "$username";
echo "<br>";
echo "$first_name";
$qry="update cust_info set first_name=$first_name where
username=$username";
$result=@mysql_query($qry,$connection);
@mysql_free_result($result);
@mysql_close($connection);
// header ("location:add_5.htm");
exit;
?>
Thank!
Tony