Re: Re: catch the error

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

 




In examples sent to you, people foolishly replaced your $db var with
$db_connect ONLY FOR PART OF THE SCRIPT. You've defined your database
connection as $db_connect in some versions of the source, but then you
reference $db (without _connect) in your mysql_select call in that same
source.

$db = mysql_connect([option list here]); # <-- this code instantiates a
connection
mysql_select_db([some name], $db); # notice how $db is here?
$result = mysql_query([some query], $db); # it's here, too!

$db becomes your resource link when you use mysql_connect. That resource
link must then be passed to your mysql functions. Otherwise, they have
no idea which database connection you are attempting to use.

RTFM?

If no connection is specified, the last one is used.

It is an optional argument (only *really* needed when you have multiple connections in the same script).

--
Postgresql & php tutorials
http://www.designmagick.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