This while loop is not performing any of the echo’s. I’ve tested mysql_num_fields($result); and it gives me 16 so it’s not that $i is already greater than $j. It’s not going infinite on me either, just doing nothing.
while ($row = mysql_fetch_array($result))
{
$i = 1;
$j = mysql_num_fields($result);
if ($i <= $j) {
echo "<li>";
echo "<a id='autoload' href='images/big/".$row['card$i'].".jpg' class='highslide' onclick='return hs.expand(this, config1 )'>";
echo "<img src='images/small/".$row['card$i']."jpg' alt''";
echo " title='";
echo $year." ". $brand." ".$playerfirst." ".$playerlast." ".$details."'/>";
echo "</a>";
echo "</li>";
$i++;
}
else {
break;
}
}
I guess I should have said that this query only returns 1 row. I then need to pull a number from several different columns (card1, card2, card3…card16) and put it in as the image file name as you see above. Also I understand all of the mysqli and protection from injection stuff I just don’t really need to worry about it with this sort of project.
FROM PHP MANUAL
your while will run only for each result. You should only need to do
Doing this will cycle only through each result. While there is a row from the result, do this. Return to the top then do again if there is still a row availabe