I have a new if/else challenge.
I have a situation where I have a video file and and image file in the database. All records have an image file but only some have a video file.
I also have a 'show_vid' field.
When this is set to "Y", I only want to only show the video file, otherwise when it is checked "N" it should show the image instead.
This works when there is not a video, but when there is a video, and 'set_id' is set to "Y", I get BOTH the video file and the image file.
Obviously, I am missing something in my syntax below:
---------------------------
<?php
if ($rsObservation->getColumnVal('show_vid') == "Y")
{echo $rsObservation->getColumnVal("video",false);
}
else
{echo'<img src="upload/news/';
echo $rsObservation->getColumnVal("image",false);
echo '" width="1920" height="1080" alt=""/>';
}
?>
----------------------
UPDATE: Actually this now seems to work like this using two PHP statements:
---------------------------
<?php
if ($rsObservation->getColumnVal('show_vid') == "Y")
{echo $rsObservation->getColumnVal("video",false);
}
else {
echo "";}
?>
<?php
if ($rsObservation->getColumnVal('show_vid') == "N")
{echo'<img src="upload/news/';
echo $rsObservation->getColumnVal("image",false);
echo '" alt=""/>';
}
else {
echo "";}
?>
----------------------------------------------------
Thanks for any advice.