Hi
I am creating an basic online menu ordering system, what i want to do is display the typical chilli level, vegetarian and nut icons/symbols along side a dish name.
I have a product table which has all the required field which will be called out.
spice level, veg and nut is stored as enum on sql database.
Spice = '0','1','2','3' representing: none, mild, medium and hot
vegetarian = '0','1' representing: Not Suitable for, and Suitable
nut = '0','1' representing: nut free, and contains nut
--------------------
At the moment it does display like the above but when i try to replace the numbers with images it doesn't display anything.
I created this within a function.
function product_starter(){
$get = mysql_query('SELECT * FROM products INNER JOIN categories ON categories.c_id = products.c_id WHERE categories.c_id = 1 ORDER BY p_id ASC');
if (mysql_num_rows($get) == 0) {
echo "There are no products available!";
}
else{
while ($get_row = mysql_fetch_assoc($get))
$veg="";
$nut="";
$spice="";
if ($p_spice == "1"){
$spice='<img src="../Resources/chili.png" width="16" height="16" alt="chilli" />';
}else if($p_spice == "2"){
$spice='<img src="../Resources/chili.png" width="16" height="16" alt="chilli" /> <img src="../Resources/chili.png" width="16" height="16" alt="chilli" />';
} else if ($p_spice == "3"){
$spice='<img src="../Resources/chili.png" width="16" height="16" alt="chilli" /> <img src="../Resources/chili.png" width="16" height="16" alt="chilli" /> <img src="../Resources/chili.png" width="16" height="16" alt="chilli" />';
}
if ($p_veg == "0"){
$veg='';
}else if($p_veg == "1"){
$veg='<img src="../Resources/veg.png" width="16" height="16" alt="chilli" /> <img src="../Resources/chili.png" width="16" height="16" alt="chilli" />';
}
if ($p_allergy == "0"){
$nut='';
}else if($p_allergy == "1"){
$nut='<img src= src="../Resources/nut.png" width="16" height="16" alt="chilli" /> <img src="../Resources/chili.png" width="16" height="16" alt="chilli" />';
}
echo '<table width="500" border="0" style="margin-bottom: 5px;">
<tr>
<td colspan="2" width="400">'.$get_row['p_name'].''.$veg.'' .$spice. ''.$nut.'</td>
<td width="100">'.number_format($get_row['p_price'], 2).' <a href="cart.php?add='.$get_row['p_id'].'">Add</a></td>
</tr>
<tr>
<td width="350" colspan="2">'.$get_row['p_desc'].'</td>
<td width="100"></td>
</tr>
</table>';
}
}