PHP category thing (@_@)

Wenslock's Avatar
Newbie Member
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!
0
pradeep's Avatar, Join Date: Apr 2005
Team Leader
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):
Code: PHP
switch($category)
   {
     case 'canvas':
         include('canvas.inc.php');
         break;
     case 'acrylic':
         include('acrylic.inc.php');
         break;
   }