Ok then guys, this is embarassing. I am getting this PHP error, already linted, checked code and don’t get the answer. Any suggestion?
**Warning**: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in file.php on line **, heres the complete code
<?
session_start();
include 'keys.php';
include 'EpiCurl.php';
include 'EpiOAuth.php';
include 'EpiTwitter.php';
?>
As additional data, it pushes data correctly to databases but interrupts the following part of the code.
UPDATE: The problem was in the “require” files, not in the code I posted, I was using this code: while($results = mysql_fetch_array($results)) { in where I repeated 2 $results
You’re assuming that
mysql_query()with aSELECTstatement always returns a resultset resource. This is not the case. Quote frommysql_query()documentation:Thus, in case of error you end up passing a boolean
FALSEvalue tomysql_fetch_array()instead of a resultset. This is why one should check whether the value returned bymysql_query()isFALSEbefore passing it to other functions as a resultset.UPDATE: Apparently the code we were shown was different from the one actually causing the problem. The problem was caused by passing a return value from
mysql_fetch_array()back to it on a second call:Either way, passing a value which isn’t a resultset to
mysql_fetch_array()was the cause of the issue exactly as the error message said: