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..

 

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.