Jump to content

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given i


andrew89898

Recommended Posts

I have that error repeated alot : here are the other errors

 

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given i

n C:\Users\Andrew Hunt\Desktop\iFox.snap\Engines\MySQL\MySQL.php on line 14

 

Warning: mysql_free_result() expects parameter 1 to be resource, boolean given i

n C:\Users\Andrew Hunt\Desktop\iFox.snap\Engines\MySQL\MySQL.php on line 15

 

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given i

n C:\Users\Andrew Hunt\Desktop\iFox.snap\Engines\MySQL\MySQL.php on line 14

 

Warning: mysql_free_result() expects parameter 1 to be resource, boolean given i

n C:\Users\Andrew Hunt\Desktop\iFox.snap\Engines\MySQL\MySQL.php on line 15

 

The first 20 lines look like this :

final class MySQL {
    const ASSOC = MYSQL_ASSOC;
    
    public static function Connect($func_host, $func_user, $func_pass) { return mysql_connect($func_host, $func_user, $func_pass); }
    public static function Select($func_database)                      { return mysql_select_db($func_database);                   }
    public static function &Query($func_query)                         { return mysql_query($func_query);                          }
    public static function FetchArray(&$func_res, $func_type)          { return mysql_fetch_array($func_res, $func_type);          }
    public static function FreeResult(&$func_res)                      { return mysql_free_result($func_res);                      }
    public static function Error()                                     { return mysql_error();                                     }
    
    public static function GetData($func_statement) {
      $func_retVal = array();
      
      $func_res = self::Query($func_statement);
      while($func_line = self::FetchArray($func_res, MySQL::ASSOC)) $func_retVal[] = $func_line;
      MySQL::FreeResult($func_res);
      
      return $func_retVal;
    }
    
    public static function Insert($func_table, $func_data) {

 

Thanks for help and the mysql info is correct..

 

without seeing the code that utilizes that class, i suspect that after using the Query function, you would check Error() to see if it executed properly. Many of us here do not use a MySQL class, but just use the MySQL functions directly, for instance:

 

$link = mysql_connect('localhost','username','password') or die(mysql_error());
mysql_select_db('databasename') or die(mysql_error());
$sql = "SELECT some_field FROM some_table WHERE id = 1"; // simple sql example
$result = mysql_query($sql) or die(mysql_error() . " IN $sql"); // Here's where you'll get an error if the SQL is invalid.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.