Endless cycle while challenged from OBD
-
There's an O.D., I want to get it out through the cycle while, but when the code opens in the browser, it starts an endless cycle. Help with the decision. PHP code:
$queryConnEntity = "SELECT * FROM `entity`"; $sqlConnEntity = mysqli_query($link, $queryConnEntity);
$resultEntityAside = mysqli_fetch_assoc($sqlConnEntity);
while( $resultEntityAside ) {
echo($resultEntityAside['entity']);
}
-
You have a mistake in understanding how it works.
mysqli_fetch_assoc()
♪ This function works as a generator. Each new functionmysqli_fetch_assoc
returns the associated body of the new line orfalse
where the lines have ended or are not available at all.In your case, the first line has been returned all the time.
$queryConnEntity = "SELECT * FROM `entity`"; $sqlConnEntity = mysqli_query($link, $queryConnEntity);
while( $resultEntityAside = mysqli_fetch_assoc($sqlConnEntity)) {
echo($resultEntityAside['entity']);
}