Frage

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

Keine korrekte Lösung

Andere Tipps

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);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top