Am I missing something important here ?

From: Date: Wed, 23 May 2001 23:02:23 +0000
Subject: Am I missing something important here ?
Groups: php.db 
Request: Send a blank email to php-db+get-9589@lists.php.net to get a copy of this message
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

« previous php.db (#9589) next »