Hello all,
I’m having trouble extracting the correct $result, depending on whether or not a FEATURE ITEM exists in the db. If there is no feature, the code should default to a basic $sql >> $result >> $row
I know how to display using a while statement. But, how do I show an “elsewhile” equivelent?
Here’s the code. Thanks in advance:
[php]
//select items marked as Features in ascending order
$feature_sql = “SELECT * FROM sale_items WHERE gallery_name = ‘cool_name’ && feature != ‘’ ORDER BY feature ASC”;
$feature_result = mysql_query($feature_sql) or die (‘Could not attain feature items’);
//now collect all other items
$sql = “SELECT * FROM sale_items WHERE gallery_name = ‘cool_name’ && feature = ‘’ ORDER BY id ASC LIMIT $startRow,”;
$result = mysql_query($sql) or die(‘Problem collecting item info’);
/* NEED TO KNOW HOW TO DICTATE WHAT $row =
mysql_fetch_assoc($result);
or
mysql_fetch_assoc($feature_result);
*/
//get image to display as Main
if (isset($_GET[‘image’])) {
$mainImage = $_GET[‘image’];
}
else {
$mainImage = $row[‘filename’];
}
[/php]