I have the following loop:
while($row = mysql_fetch_assoc($result)) {
<some code>
if ($user)
echo '<li><a href="mahjong.php?layout='.$row['LayoutName'].'"><img src="images/layouts/'. $row['LayoutName'].'.png" alt="" /> <img src="images/'. $row['Stars'].'.png" alt="" /></a>
<div class="info">
<h2>'.$row['LayoutName'].'</h2>
<p>'.$row['LayoutTiles'].' Tiles, '.$row['LayoutLayers'].' Layers</p>
<hr size=2 color="white">
<p>Score: '.$row['Score'].'</p>
<p>Time: '.$row['Time'].'</p>
</div>
</li>';
else
<some more code>
}
This while loop works perfectly, but sometimes some variables have no data. This is correct, because there is simple none in the database. If this happens, it shows nothing. I want it so, that if the variable is empty, it echoes a 0.
Example $row['Score'] = empty -> 0
Thanks,
ps it is possible that $row['Time'] has a value and $row['Score'] not!!
You could do something like this:
Hope it helps!