RE: [PHP-DB] mysql_error() (was Re: Getting last insert id?)
| From: | Jeremy Shovan | Date: | Fri, 10 Oct 2003 21:29:32 +0000 |
| Subject: | RE: [PHP-DB] mysql_error() (was Re: Getting last insert id?) | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-30973@lists.php.net to get a copy of this message | ||
Use echo(mysql_error());
-----Original Message-----
From: Ben Edwards [mailto:ben@videonetwork.org]
Sent: Friday, October 10, 2003 5:43 AM
To: pete M
Cc: PHP DB List
Subject: Re: [PHP-DB] mysql_error() (was Re: Getting last insert id?)
On Thu, 2003-10-09 at 17:35, pete M wrote:
> http://www.php.net/manual/en/function.mysql-error.php
>
> Ben Edwards wrote:
>
> > On Thu, 2003-10-09 at 16:33, pete M wrote:
> >
> >>$new_id = mysql_query('select last_insert_id()');
> >>
> >>your can also user it within a query - eg
> >>
> >>$sql = ' insert into related table parent_id, data , data2) values
> >>(last_insert_id(), 23, 45);
> >>
> >
> >
> > Is there also a similar way of getting the last error message, i.e.
> >
> > $new_id = mysql_query('select error()');
> >
> > I currently am trying to solve the problem or mysql_error()
returning
> > nothing after an error. It may be something to do with globals and
> > something like the above may help.
> >
> > Ben
This I know, its just that the function always returns nothing so I was
looking for an alternative way of getting the error.
--
****************************************************************
* Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 *
* Homepage - nothing of interest here http://gurtlush.org.uk
*
* Webhosting for the masses http://www.serverone.co.uk *
* Critical Site Builder http://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online http://www.cultureshop.org *
* i-Contact Progressive Video http://www.videonetwork.org *
* Fun corporate graphics http://www.subvertise.org *
* Bristol Indymedia http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *
****************************************************************