PHP category thing (@_@)

Discussion in 'PHP' started by Wenslock, Aug 29, 2006.

  1. Wenslock

    Wenslock New Member

    Joined:
    Aug 29, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi. I've got PHP Problem. I'm designing a new site that requires categories. (ie Canvas, acrylic, oil, etc). I'm using PHP include to throw all the PHP & HTML together it was looking really good until I came across this problem.

    I know it would probably have to do with 'isset' and things, but like me and languages (whether it be computer or country), I can understand fragments but not the whole picture.

    I think what I am looking for is something like:

    if (isset (canvas))

    {<<DATABASE CONNECTION STUFF>> WHERE pictype = canvas";
    }

    if (isset (acryllic))

    {<<DATABASE CONNECTION STUFF>> WHERE pictype = acryllic";
    }

    etc.

    Is that correct, can someone point me in the right direction!??! Is this the end of Wenslock's adventures??!??! TUNE IN NEXT TIME FOLKS TO FIND OUT!
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    I think you'll probably need to load only one category at a time.
    So you can use the SWITCH construct or IF..ELSE IF..ELSE construct.

    Example (Switch):
    PHP:
    switch($category)
       {
         case 
    'canvas':
             include(
    'canvas.inc.php');
             break;
         case 
    'acrylic':
             include(
    'acrylic.inc.php');
             break;
       }
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice