doddsey_65 Posted January 23, 2011 Share Posted January 23, 2011 mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean i get that error with this code: $online_query = $link->simple_query('u_username', 'users', 'u_online=1 AND u_hidden != 1', '0u_username'); while($online_info = $link->fetch_array($online_query)) //THIS LINE THROWS THE ERROR the simple_query function is: function simple_query($fields, $table, $clause, $order) { global $link, $config; if(!empty($clause)) { $clause = "WHERE $clause"; } else { $clause = ''; } if(!empty($order)) { $direction = $order[0]; switch($direction) { case '0': $direction = 'ASC"'; break; case '1': $direction = 'DESC'; break; } $order = substr($order, 1, strlen($order)); $order = "ORDER BY $order $direction"; } $query = mysqli_query($this->link, "SELECT $fields FROM ".TBL_PREFIX."$table $clause $order"); return $query; } when i use a normal query instead of my simple_query function it works fine. it also worked fine before i made the database class. Where am i going wrong? Quote Link to comment https://forums.phpfreaks.com/topic/225402-query-error/ Share on other sites More sharing options...
Pikachu2000 Posted January 23, 2011 Share Posted January 23, 2011 Echo the query string out of the function and see what's wrong with it. Quote Link to comment https://forums.phpfreaks.com/topic/225402-query-error/#findComment-1164017 Share on other sites More sharing options...
doddsey_65 Posted January 24, 2011 Author Share Posted January 24, 2011 echoing the query string returns 1(or true since its a bool) Quote Link to comment https://forums.phpfreaks.com/topic/225402-query-error/#findComment-1164298 Share on other sites More sharing options...
doddsey_65 Posted January 24, 2011 Author Share Posted January 24, 2011 solved - misplaced quote: case '0': $direction = 'ASC'"; Quote Link to comment https://forums.phpfreaks.com/topic/225402-query-error/#findComment-1164300 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.