Question

I have this code:

$query  = "SELECT * FROM maintable;";
mysqli_query($link, $query) or die("Error: ".mysqli_error($link));
$i = 0;
do{
    $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
    echo '<p>'.$row["Description"].'</p>';
     $i++;
}while($row && $i<10);

and or die does not print any errors, but it is still not working and gives me messege:

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given

No correct solution

OTHER TIPS

Try this:

$query  = "SELECT * FROM maintable;";
$result = mysqli_query($link, $query) or die("Error: ".mysqli_error($link));
$i = 0;
do{
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
echo '<p>'.$row["Description"].'</p>';
 $i++;
}while($row && $i<10);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top