mysql_query
am 10.08.2009 10:15:08 von Ron Piggott
------=_NextPart_000_0011_01CA1971.25BEF1B0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
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 =3D "UPDATE ... ";
mysql_query($query);
How do I test if the INSERT INTO mysql_query, in order to trigger the =
UPDATE?
Ron
------=_NextPart_000_0011_01CA1971.25BEF1B0--
Re: mysql_query
am 10.08.2009 10:57:59 von David Robley
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.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: mysql_query
am 10.08.2009 13:49:31 von Phpster
On Aug 10, 2009, at 4:15 AM, "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 use the REPLACE syntax in mysql
http://dev.mysql.com/doc/refman/5.0/en/replace.html
Bastien
Sent from my iPod
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php