Hi,

I will write a function that returns the result of a recordset.
I tried this:

  Function getPersonen()
  {
       openDB();  //function that I implements in another file


     $query = "SELECT * FROM Cursisten";
     $result = mysql_query($query)
     or die("Fout bij uitvoeren query");

     $resultrow = mysql_fetch_array( $result );

     closeDB();   //function that I implements in another file
   mysql_free_result($result);

    return $resultrow;

  }

I call this function:

    $resultaat =  getPersonen();
  // Printen resultaten in HTML
 print "<table>\n";
 while ($line = mysql_fetch_array($resultaat, MYSQL_ASSOC)) {
     print "\t<tr>\n";
     foreach ($line as $col_value) {
         print "\t\t<td>$col_value</td>\n";
     }
     print "\t</tr>\n";
 }
 print "</table>\n";

 In runtime I have the following error

  Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in
/home/schoolre/public_html/Hitek/Online/Registratie/showPerson.php on line 8

What is wrong?

Alain

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to