When I executed this code,
while($row = mysql_fetch_array($res))
there was an error of the following plan:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in String of treatment:while($row = mysql_fetch_array($res))
When I executed this code,
while($row = mysql_fetch_array($res))
there was an error of the following plan:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in String of treatment:while($row = mysql_fetch_array($res))
$res should be an resource , for example
$res = mysql_query("SELECT * FROM table;");
after that only use mysql_fetch_array. Just for information
This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used.
Would be better to use mysqli_query instead of mysql_query. Read this answer and this PHP documentation about differences between them. So I advice you to use mysqli:
$result = mysqli_query($connection, 'SELECT id, name FROM some_table');
if($result){
while($row = mysqli_fetch_assoc($result)){
//extract values from row
$id = $row['id'];
$name = $row['name'];
}
}