RE: [PHP] MySQL's UPDATE & PHP
| From: | Joe Kaiping | Date: | Sat, 29 Sep 2001 20:40:18 +0000 |
| Subject: | RE: [PHP] MySQL's UPDATE & PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-69317@lists.php.net to get a copy of this message | ||
Hi,
Looks like you may just need to quote $username and $first_name:
$qry="update cust_info set first_name='$first_name' where
username='$username'";
-Joe
> -----Original Message-----
> From: afrodriguez@att.net [mailto:afrodriguez@att.net]
> Sent: Saturday, September 29, 2001 1:28 PM
> To: php-general@lists.php.net
> Subject: [PHP] MySQL's UPDATE & PHP
>
>
> 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>