mysqli_fetch_array() expects parameter 1 to be mysqli_result
Bonjour,
j'ai le warning du titre avec ce code :
Code:
1 2 3 4 5 6 7 8 9
| $timestamp=time();
$ip=$_SERVER['REMOTE_ADDR'];
$query ="select * from visites where ((".$timestamp." - timestamp <= 3600) and ip = ".$ip.")";
$result=mysqli_query($db,$query);
$timestampmax=0;
while ($ligne = mysqli_fetch_array($result)) {
if ($ligne['timestamp']>$timestampmax) $timestampmax=$ligne['timestamp'];
} |
et si j'active l'affichage des erreurs mysqli avec mysqli_report(MYSQLI_REPORT_ALL);le warning est remplacé par ces 2 messages :
Citation:
Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.0.1)' at line 1' in C:\wamp\www\test\compteur.php on line 27
Citation:
mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.0.1)' at line 1 in C:\wamp\www\test\compteur.php on line 27
qu'est-ce qu'il faut changer ?