Hi,
I have a problem that got ZERO response in the “general help” section, so I’m posting it here, as this seems like a small problem.
I have an image gallery that should first check the “feature” column in the db, in order to show featured images first. But, after retrieving feature images (or if there are none), I want the code to continue collecting the remaining images in the gallery (that are not marked as feature - blank field).
I have constructed two $sql queries, one for each:[php]
//gather featured items if avail
$fsql = “SELECT * FROM sale_items WHERE gallery_name = ‘cutting_edge_name’ AND feature != ‘’ ORDER BY feature ASC LIMIT $startRow,”.GALMAX; //GALMAX set to limit results per page
$fresult = mysql_query($sql) or die(‘Problem attaining feature items’);
//then get the remaining images
$sql = “SELECT * FROM sale_items WHERE gallery_name = ‘cutting_edge_name’ AND feature = ‘’ ORDER BY image_id ASC LIMIT $startRow,”.GALMAX;
$result = mysql_query($sql) or die(‘Problem attaining sale items’);
[/php]
My problem is in not knowing exactly how to display the results in a flowing manner. I want to use the following code - which is intended to display only one set of results, and the first result at that, using $row. My question is, what’s the best way for me display a $row[‘filename’] result from the second $sql statement, if the first one is empty?
[php]//display image on click, or get first result from db if !$_GET
if (isset($_GET[‘image’])) {
$mainImage = $_GET[‘image’];
}
else {
$mainImage = $row[‘filename’]; //THIS VALUE IS WHERE I NEED TO DISPLAYONE VAL OR THE OTHER
}[/php]