Basically I am working a site store and having problems with it. Nothing online seems to have what I need to figure out. I am having the first if else statement working fine and the second not working properly. Here is the coding tell me what is wrong or what I can do different.
<?php
$adsql = mysql_query("SELECT * FROM store_items WHERE userid='$id2'");
while($adrow = mysql_fetch_array($adsql)){
$type = $adrow['type'];(this is int)
$item = $adrow['id'];
if ($type == 1) {
$item1 = "<center>You have bought this already</center>";
} else {
$item1 = This is where item1 is bought
}
if ($type == 2) {
$item2 = "<center>You have bought this already</center>";
} else {
$item2 = This is where item2 is bought
</table>
";
}
}
?>
Its retrieving the last number not all the numbers which in return only showing 1 of if else statements instead of both. Any idea what is wrong be a appreciated.