Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Nov 2006
    Posts
    71
    Thanks
    12
    Thanked 0 Times in 0 Posts

    IF exists in an associative array

    PHP Code:
    //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?
    Last edited by pcproff; 08-23-2011 at 10:13 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •