RE: [PHP] Update statement?
| From: | Wee Chua | Date: | Thu, 19 Oct 2000 13:04:27 +0000 |
| Subject: | RE: [PHP] Update statement? | ||
| Groups: | php.db php.general | ||
| Request: | Send a blank email to php-general+get-21146@lists.php.net to get a copy of this message | ||
Hi james,
I tried your if statement and it didn't work correctly, would you correct my
if statement if that's anything wrong. And how could display the error
message if mysql_error() contains one? Thank you.
if(!$update = mysql_query("update Employee set Name='John' where
Id=1",$db))die("Error updateding records.<BR>".mysql_error($db)."");
if (mysql_error($db)){
echo "Row not updated";
} else {
echo "Row updated";}
calvin
-----Original Message-----
From: James Atkinson [mailto:james.atkinson@100world.ca]
Sent: Wednesday, October 18, 2000 4:48 PM
To: Wee Chua; PHP (E-mail)
Subject: Re: [PHP] Update statement?
On Wed, 18 Oct 2000, Wee Chua wrote:
> Hi all,
> Can anyone tell me that has the row been updated from mysql message. What
if
> I have entered wrong datatype, mysql server would give me an error
message,
> how could put into php codes? Please help, thank you!
>
> $update=mysql_query("update Employee set Name=John where Id=1",$db);
>
> Calvin
Ok...if I understand correctly you want to output an error message from
mysql?
if(!$update = mysql_query("update Employee set Name=John where Id=1",$db))
die("Error updateding records.<BR>".mysql_error($db)."");
that should work, if I understood the question...
--
James Atkinson
-----------------------------------------------------------------
James Atkinson 100world
Technical Developer 512-1529 West 6th Avenue
phone: +1-604-637-8122 Vancouver, BC, V6J 1R1
fax: +1-604-742-1770 Canada
email: james.atkinson@100world.com http://www.100world.com
+---------------------------------------------------------------+
| This message may contain confidential and/or privileged |
| information. If you are not the addressee or authorized to |
| receive this for the addressee, you must not use, copy, |
| discolse or take any action based on this message or any |
| information herein. If you have received this message in |
| error, please advise the sender immediately by reply e-mail |
| and delete this message. Thank you for you cooperation |
+---------------------------------------------------------------+