Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PHP3] Easy question

0 views
Skip to first unread message

Richard Lynch

unread,
Apr 15, 2000, 3:00:00 AM4/15/00
to
In article <009401bfa61d$922f50a0$84cafc3e@NDS01>,
se...@networkdata.co.uk wrote:

> ------=_NextPart_000_0091_01BFA625.F050EF60
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> hi,
>
> I have a form
> the form action is sell.php3
> for an autoincrement field i use=20
> $query =3D"INSERT INTO table1... ";
> $query .=3D"VALUES ('$field1','$field2',LAST_INSERT_ID())";
>
> I am trying to echo the calue of the auto inc field by using the =
> following code I found in a book
>
> echo "the last inserted id #: ".mysql_insert_id(). "\n";
>
> The value I keep getting is 0 - would anyone know why?

Add some error-checking code, as described in the FAQ (look for " or
die()") in some of the solutions there.

--
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-uns...@lists.php.net
To subscribe to the digest, e-mail: php3-diges...@lists.php.net
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-lis...@lists.php.net


0 new messages