...

View Full Version : IF exists in an associative array



pcproff
08-23-2011, 08:51 PM
//QUERY
$mycountry=@mysql_query("SELECT c.* ". "FROM country AS c ". "WHERE c.CountryID=$cid");

if (!$mycountry) {
echo("<p>Error fetching country details: " .
mysql_error() . "</p>");
exit();
}

//ASSIGNING ASSOC. ARRAY
$mycountry = mysql_fetch_array($mycountry);

//I used to use this but this is very limiting I want to try check if something exists in the db
$photo = $mycountry["photo"];

//NEW CODE TO ME TO REPLACE LINE ABOVE

$photo = $country_front if [EXISTS SELECT AlbumName FROM gallery.albumtb WHERE categoryID == 2 THEN $photo = 1];
endif;




Do I have this syntax right? I cannot get it to execute and is this even possible inside of an Assoc. Array?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum