while($row = mysql_fetch_assoc($result)){
if ($row['quantity'] = "0"){
echo'
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" height="101" border="0" align="center" valign="top">
<tr valign="middle">
<td align="center"><img align="center" height="140" width="100" src="'.$row['picurl'].'"></td>
<td width="300" height="97"><a href="index.php?view=dvd&id='.$row['dvdid'].'">'.$row['dvdname'].'</a></td>
<td width="100" align="center">£'.$row['price'].'</td>
<td width="100" align="center">Out Of Stock!</td>
</tr>
</table>
</td>
</tr>
</table>';
}else{
echo'
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" height="101" border="0" align="center" valign="top">
<tr valign="middle">
<td align="center"><img align="center" height="140" width="100" src="'.$row['picurl'].'"></td>
<td width="300" height="97"><a href="index.php?view=dvd&id='.$row['dvdid'].'">'.$row['dvdname'].'</a></td>
<td width="100" align="center">£'.$row['price'].'</td>
<td width="100" align="center"> '.$row['quantity'].'</td>
</tr>
</table>
</td>
</tr>
</table>';
}
}
If Statments In mysql and PHP
Started by Crofty, Sep 23 2006 07:10 AM
2 replies to this topic
#1
Posted 23 September 2006 - 07:10 AM
Ok well im trying to use a if statments to display different outputs, but it wont display out of stock when quantity = 0
#2
Posted 23 September 2006 - 07:17 AM
Simple one,
if ($row['quantity'] == "0"){
#3
Posted 23 September 2006 - 07:26 AM
oh yeah i forgot about the double =
thanks
thanks
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
