RE: catch the error

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

 




>-----Original Message-----
>From: PJ [mailto:af.gourmet@xxxxxxxxxxxx]
>Sent: Thursday, February 26, 2009 12:28 PM
>To: php-general@xxxxxxxxxxxxx; MySql
>Subject: catch the error
>
>What is wrond with this file? same identical insert works from console
>but not from this file :-(
>
><html>
><head>
>    <title>Untitled</title>
></head>
>
><body>
><?
>//include ("lib/db1.php");    // Connect to database
>mysql_connect('biggie', 'user', 'password', 'test');
>$sql1 = "INSERT INTO example (name, age) VALUES ('Joe Blow', '69')";
>$result1 = mysql_query($sql1,$db);
>if (!$result1) {
>  echo("<P>Error performing 1st query: " .
>       mysql_error() . "</P>");
>  exit();
>}
>?>
>
></body>
></html>
>
>Seems to be good to print out the error message, but that's all. db not
>written.
>
[JS] You need

  $db = mysql_connect('biggie', 'user', 'password', 'test');

>--
>
>Phil Jourdan --- pj@xxxxxxxxxxxxx
>   http://www.ptahhotep.com
>   http://www.chiccantine.com
>
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe:    http://lists.mysql.com/mysql?unsub=jschwartz@the-
>infoshop.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