Okay so I've been fighting with this for awhile now and haven't found a better way yet....

What I want to do, is I have a small portion of my website included into a template. It is displaying hosting plans so on the main site "index.php" I want it to display a little bit of text (Same as on the main hosting page) and just 1 random hosting plan. then if they click on that plan and go into the main hosting section, I want them to see ALL the hosting plans.


Here's the code that I'm using:

if($_SERVER['PHP_SELF'] = "/index.php") {
    $sql = "SELECT * FROM `hosting` ORDER BY RAND() LIMIT 1";
}else{
    $sql = "SELECT * FROM `hosting` ORDER BY `hostingSort` ASC";

}

Now... I know there MUST be a better way to do it but I can't see the tree's through the forest.

Any other way I could do it?

I'm avoiding having lots of duplicate code/text on my pages.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to