note 35391 added to function.return

From: Date: Fri, 29 Aug 2003 13:53:36 +0000
Subject: note 35391 added to function.return
Groups: php.notes 
Request: Send a blank email to php-notes+get-55301@lists.php.net to get a copy of this message
It seems like you can't return (MySQL-result-)resources. I just wanted to use this function to simplify error checking in my app: <?php function db_query($query) { return mysql_query($query) or die("Bad Query: $query;".mysql_error()); } ?> but I could not use the return value of this function, because the mysql stuff complained about the validity of the result resource. If I replace any db_query() call with mysql_query(), everything works nicely. ---- Manual Page -- http://www.php.net/manual/en/function.return.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35391 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35391&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35391&report=yes

« previous php.notes (#55301) next »