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:[EMAIL PROTECTED]]
> Sent: Thursday, May 24, 2001 1:02 AM
> To: [EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to