So I have a validation in null values using while statement the code is
while (!$rs->EOF){
echo "<tr><td>".$rs->Fields("Branch")."</td>";
$rs->movenext();
}
$rs->Close();
?>
What I wanted to achieve is to have an "else" statement though I know its not possible using the where statement. Which one is equivalent of it in where statement?
while (!$rs->EOF){
echo "<tr><td>".$rs->Fields("Branch")."</td>";
$rs->movenext();
}
if(!$rs->EOF)
{
echo "<tr><td> Branch is missing</td>";
}
$rs->Close();
?>
I tried using "if" I didn't get any errors though it didn't print what I wanted to print
While-Else does not exists in php.
You could use:
if ($rs->EOF) {
echo "<tr><td> Branch is missing</td>";
} else {
while (!$rs->EOF){
echo "<tr><td>".$rs->Fields("Branch")."</td>";
$rs->movenext();
}
}
$rs->Close();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With