andrew89898 Posted January 24, 2011 Share Posted January 24, 2011 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.. Quote Link to comment Share on other sites More sharing options...
btherl Posted January 24, 2011 Share Posted January 24, 2011 When you do a query, you should check to see if it succeeded or not before using mysql_fetch_array(). If the result is the boolean value "false", then the query failed. Quote Link to comment Share on other sites More sharing options...
andrew89898 Posted January 25, 2011 Author Share Posted January 25, 2011 How do I check!? Quote Link to comment Share on other sites More sharing options...
andrew89898 Posted January 25, 2011 Author Share Posted January 25, 2011 I've found out something new, In a different file: it says this //... How 'bout checking for the MySQL Module in that File, and when it doesn't exist, LOAD IT (either *.so or *.dll) Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted January 25, 2011 Share Posted January 25, 2011 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.