Jump to content

Function with if statements


jaxdevil

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.