RE: [PHP] Re: MySQL Native Function in PHP Query Not Working?
| From: | UGBI) | Date: | Wed, 19 Dec 2001 08:46:43 +0000 |
| Subject: | RE: [PHP] Re: MySQL Native Function in PHP Query Not Working? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-78191@lists.php.net to get a copy of this message | ||
LAST_INSERT_ID() only works in a select.
This should be the correct syntax, but MySQL 3.xx.xx doesnot support
SubQueries. I believe that MySQL 4 does or will in the near future.
SELECT * FROM table WHERE aid=(SELECT LAST_INSERT_ID())
Jerry Verhoef
-----Original Message-----
From: Chris Lee [mailto:lee@mediawaveonline.com]
Sent: Tuesday, December 18, 2001 6:45 PM
To: php-general@lists.php.net
Subject: [PHP] Re: MySQL Native Function in PHP Query Not Working?
that command doesnt even work from the mysql command prompt for me, Ive
never used LAST_INSERT_ID(), but it dont work for me. try it on your mysql
command prompt.
--
Chris Lee
lee@mediawaveonline.com
"Ise" <ise@tao.ca> wrote in message
news:ELEGLBLIMMILFAOLDIPEIEAPCOAA.ise@tao.ca...
> Hello,
>
> Can someone explain to me why the below SQL query when executed with the
PHP
> mysql functions does not work? (it returns nothing)
>
> SELECT * FROM table WHERE aid=LAST_INSERT_ID()
>
> If I replace the MySQL function "LAST_INSERT_ID()" with a integer, it
works
> fine so its not the query. Further, I was returned results on the above
> query when I ran it directly from a MySQL client. Does PHP not support
> certain MySQL native functions?
>
>
> Thanks,
>
> Michael Caplan
> Institute for Social Ecology
> http://www.social-ecology.org/
>
> 1118 Maple Hill Road
> Plainfield, VT, 05667 USA
>
> Tel.: 1 (514) 421-3515
> General Tel. / Fax.: 1 (802) 454-8493
>
--
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
The information contained in this email is confidential and
may be legally privileged. It is intended solely for the
addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any
form of disclosure, production, distribution or any action
taken or refrained from in reliance on it, is prohibited and
may be unlawful. Please notify the sender immediately.
The content of the email is not legally binding unless
confirmed by letter bearing two authorized signatures.