Freedom-n-Democrazy Posted September 12, 2011 Share Posted September 12, 2011 What an Earth is wrong with this code? $query = "select sizes from products where id='$id'"; $result = mysql_query($query); $row = mysql_fetch_array($result); if ($row == 0) {echo "";} else {echo "Small - $row['sizes']";} PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING Link to comment https://forums.phpfreaks.com/topic/246971-what-have-i-done-wrong/ Share on other sites More sharing options...
Freedom-n-Democrazy Posted September 12, 2011 Author Share Posted September 12, 2011 $row should have been $row['sizes'] Link to comment https://forums.phpfreaks.com/topic/246971-what-have-i-done-wrong/#findComment-1268360 Share on other sites More sharing options...
Psycho Posted September 12, 2011 Share Posted September 12, 2011 This doesn't have anything to do with the problem (Freedom already addressed that). But, this if ($row == 0) {echo "";} else {echo "Small - $row['sizes']";} Should just be if ($row != 0) {echo "Small - $row['sizes']";} Link to comment https://forums.phpfreaks.com/topic/246971-what-have-i-done-wrong/#findComment-1268380 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.