jaxdevil Posted July 27, 2008 Share Posted July 27, 2008 I am trying to make a function that will display a color jpeg icon (the jpeg symbol) if all three image fields in the database have images loaded. The default for the cell is 'missing', so it is looking first to see if all the image cells are equal to 'missing', if they are it displays a grayscale jpeg icon, if all the cells do not equal 'missing' then it goes to the next set of if statements, which the next two look to see if some of the cells are equal to 'missing', if some of them have the value of 'missing' and at least 1 that the value is not 'missing' (meaning an image filename is loaded to at least one of the cells), if one of those matches then it will display a half grayscale, half color jpeg icon, if that is not a match then it checks to see if all the cells are not equal to 'missing', which would mean there are image filenames loaded all of the image cells, if there are then it will display a full color jpeg icon. Below is my code. On line 14 it is saying (in PHP Designer 2008) "syntax error unexpected T_ENCAPSED_AND_WHITESPACE expecting T_STRING or T_VARIABLE or T_NUM_STRING" I don't know what to do. Anyone can help? <?php function displayPhoto($photo_code) { $photo_query = "SELECT * FROM images WHERE `mod` = '$photo_code' LIMIT 1"; $photo_result = mysql_query($photo_query) or die(mysql_error()); while($photo_row = mysql_fetch_array($photo_result)) { if ($photo_row['image_one'] == "missing") { if ( $photo_row['image_two'] == "missing") { if ( $photo_row['image_three'] == "missing") { echo "<img src=\"images/no_jpeg.gif\" border=\"0\">; } } } if ($photo_row['image_one'] != "missing") { if ($photo_row['image_two'] == "missing") { if ($photo_row['image_three'] == "missing") { echo "<img src=\"images/half_jpeg.gif\" border=\"0\">; } } } if ($photo_row['image_one'] != "missing") { if ($photo_row['image_two'] != "missing") { if ($photo_row['image_three'] == "missing") { echo "<img src=\"images/half_jpeg.gif\" border=\"0\">; } } } if ($photo_row['image_one'] != "missing") { if ($photo_row['image_two'] != "missing") { if ($photo_row['image_three'] != "missing") { echo "<img src=\"images/jpeg.gif\" border=\"0\">; } } } } } ?> Link to comment https://forums.phpfreaks.com/topic/116852-function-with-if-statements/ Share on other sites More sharing options...
Nhoj Posted July 27, 2008 Share Posted July 27, 2008 if ( $photo_row['image_three'] == "missing") { echo "<img src=\"images/no_jpeg.gif\" border=\"0\">; You're missing the ending quote after the last > just before the end of the line with ; Link to comment https://forums.phpfreaks.com/topic/116852-function-with-if-statements/#findComment-600871 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.