Help Needed...thanks in advance

I am querying my database to see if the record has an image. if it doesn’t I want to show a white box. if it does have an image in the record, I want to show the image as shown below

<?	$media_url = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "item_media WHERE item_id=" . $item_details['item_id'] . " AND 

		media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC", 'media_url');    ?>
<? if (empty($media_url)) { echo ''; } else { echo '<?=$item_details['name'];?>';

}

?>

I get the following error. Any help would be greatly appreciated

Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ at blah blah location line #128

assuming 128 is the query, then its because of media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC", ‘media_url’); ?>,

<?php $media_url = $db->get_sql_field("SELECT media_url FROM ".DB_PREFIX."item_media WHERE item_id=".$item_details['item_id']." AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC, media_url"); ?>

Do not use short tags. if you have to switch servers or upgrade php or change hosts, you’ll run into lots of problems and a lot of errors. plus its a security risk.

Sponsor our Newsletter | Privacy Policy | Terms of Service