Re: What in Hades?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Whitney wrote:
> On Thu, Feb 26, 2009 at 9:14 AM, PJ <af.gourmet@xxxxxxxxxxxx
> <mailto:af.gourmet@xxxxxxxxxxxx>> wrote:
>
>     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) { 
>
>  
> // notice the $result, should be $result1
>
>      echo("<P>Error performing query: " .
>           mysql_error() . "</P>");
>      exit();
>     }
>
>
> Hope that helps
>
> Richard
It helps, thanks for catching that... and it doesn't help... if the
result is correct, then the query should have entered the data into the
table...and regardless of the printout, the program should continue and
I would get the second query.... however, nothing is entered in the
db.... I check with phpMyAdmin on the host computer (FreeBSD 7.0)


>
>
>  
>
>
>     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@xxxxxxxxxxxxx <mailto:pj@xxxxxxxxxxxxx>
>       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
>
>
>
>
> -- 
> Richard Whitney
> phpMyDEV@xxxxxxxxx <mailto:phpMyDEV@xxxxxxxxx>
> http://phpmydev.com
> 602-288-5340
> 310-943-6498
>
> "You come up with ideas, I come up with solutions."


-- 

Phil Jourdan --- pj@xxxxxxxxxxxxx
   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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux