Re: Don't know why query works this way

From: Date: Sun, 24 Aug 2003 00:32:53 +0000
Subject: Re: Don't know why query works this way
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-30072@lists.php.net to get a copy of this message
Aaron Wolski wrote:
Here's some functions I use in my development which save on connect and query calls for me.
aaron: i do more or less the same thing. allow me to criticize your functions in one very important respect: you do not check the return value of your calls! i would suggest that anyone doing mysql work ALWAYS check the return value. it will save you MUCH head scratching later on down the line. really. eg:
function db_connect() { mysql_pconnect("localhost","username","password"); mysql_select_db("Database"); }
function db_connect {
    mysql_pconnect('localhost','username','password') or die(mysql_error());
    mysql_select_db('database') or die(mysql_error());
} and so forth. -jsd-

« previous php.db (#30072) next »