I have the following code:
while ($var1 == $var2)
{
$sql = “SELECT disabled FROM MYTABLE WHERE VAR2=’$var2’”;
$r = mysql_query($sql);
while ($row = mysql_fetch_assoc($r))
{
// do something
}
}
My problem is that $sql retrieves ten rows: 4 of them have data, the rest are empty.
As the first row is empty the second while is never entered.
But I need it to be entered, what do I have to do?
In the example code I’m using MySQL but I can use TSQL.
Thanks a lot
You can check the total rows first.
Sorry that will not work, try the below.