Re: mysql_query
| From: | David Robley | Date: | Mon, 10 Aug 2009 08:57:59 +0000 |
| Subject: | Re: mysql_query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-46437@lists.php.net to get a copy of this message | ||
Ron Piggott wrote:
> I have the syntax
>
> mysql_query("INSERT INTO ....);");
>
> If this is successful I want to do update a column in one of my tables
>
> $query = "UPDATE ... ";
> mysql_query($query);
>
> How do I test if the INSERT INTO mysql_query, in order to trigger the
> UPDATE?
>
> Ron
You could check the mysql section of the documentation, where you will find
http://php.net/manual/en/function.mysql-affected-rows.php
which will tell
you how many rows were affected by your INSERT. Alternatively, if you are
using Innodb tables, you could look at using transactions.
Cheers
--
David Robley
Those who can't write, write help files.
Today is Boomtime, the 3rd day of Bureaucracy in the YOLD 3175.