Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   PHP category thing (@_@) (http://www.go4expert.com/forums/php-category-thing-t1290/)

Wenslock 29Aug2006 08:28

PHP category thing (@_@)
 
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!

pradeep 29Aug2006 12:28

Re: PHP category thing (@_@)
 
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;
   }



All times are GMT +5.5. The time now is 07:18.