Re: What in Hades?
| From: | PJ | Date: | Thu, 26 Feb 2009 16:52:30 +0000 |
| Subject: | Re: What in Hades? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-288835@lists.php.net to get a copy of this message | ||
9el wrote:
>
> -----------------------------------------------------------------------
> Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get
> a Free CD of Ubuntu mailed to your door without any cost. Visit :
> www.ubuntu.com <http://www.ubuntu.com>
> ----------------------------------------------------------------------
>
>
> 2009/2/26 PJ <af.gourmet@videotron.ca
> <mailto:af.gourmet@videotron.ca>>
>
> Something is rotten here. Twist it any way you like and it just
> does not
> work.
> I am trying to figure out the working of SELECT LAST_INSERT_ID() and
> cannot get beyond the first $sql - But it works fine from
> command-line!
>
> <?
> include ("lib/db1.php"); // Connect to database
>
> $sql1 = "INSERT INTO test (name, age) VALUES ('Joe Blow',
> '69')";
> $result1 = mysql_query($sql1,$db);
> if ( !$result) {
>
> At the above line $result1 ?
A typo after the fact does not alter the fact. The INSERT does not work
as it should!
I don't understand why it should work on command line and not from a file.
>
>
> echo("<P>Error performing query: " .
> mysql_error() . "</P>");
> exit();
> }
>
> THIS IS WHERE IT STOPS WITH ERROR.$sql1 just refuses to work. db
> connection is fine and the INSERT works from xterm on remote puter.
> Can't figure this out.
> ============
>
>
> $sql = "SELECT LAST_INSERT_ID() FROM test";
> $result = mysql_query($sql,$db);
> if (!$result) {
> echo("<P>Error performing query: " .
> mysql_error() . "</P>");
> exit();
> }
> while ( $row = mysql_fetch_array($result) ) {
> echo("<P>" . $row["id"] . "</P>");
> }
> ?>
>
> What am I missing here? Or how can I trace the error?
>
> --
>
> Phil Jourdan --- pj@ptahhotep.com
> <mailto:pj@ptahhotep.com>
> http://www.ptahhotep.com
> http://www.chiccantine.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Phil Jourdan --- pj@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com