RE: [PHP-DB] Am I missing something important here ?

From: Date: Thu, 24 May 2001 10:34:30 +0000
Subject: RE: [PHP-DB] Am I missing something important here ?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-9600@lists.php.net to get a copy of this message
Your problem here is simply that the $queryresult gets lost in the function. It is never returned. change return true; into return $queryresult; Mats Remman > -----Original Message----- > From: annabelle.imray [mailto:annabelle.imray@ntlworld.com] > Sent: Thursday, May 24, 2001 1:02 AM > To: php-db@lists.php.net > Subject: [PHP-DB] Am I missing something important here ? > > > I have been given an example of how to use php & mysql from a hosting > company. They have the following function: > > #==== > function ExecuteQuery ($linkdb, &$queryresult, $querytext) { > > $queryresult = mysql_query($querytext, $linkdb); > > if (($queryresult != false) and (mysql_errno() == 0)) { > return true; > } else { > return false; > } > } > #==== > > And an example of it's usage: > > > $query = "SELECT * FROM test"; > > if ($mysql_result = mysql_query($query, $linkdb)) { > if (ExecuteQuery($linkdb, $result, $query)) { > while ($row = NextRow($result)) { > print('"'.$row[1].'" : > "'.$row[2].'"<br>'); > } > } > } > > Can anyone tell me why the first "if" exists in their usage > example, e.g. if > ($mysql_result = mysql_query($query, $linkdb)) { > > As the $mysql_result variable is not used after this statement > and the query > is performed again in the ExecuteQuery() function; > > As I have said, am I missing something important here? > > Thanks > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.db (#9600) next »