View Single Post
Old 08-18-2010, 12:16 AM   #1 (permalink)
Seal
The Visitor
Newcomer 
 
Join Date: Aug 2010
Location: Pahrump, NV
Posts: 1
Thanks: 0
Seal is on a distinguished road
Default Switch Command Problems

Before I ask my question, let me say that I am an old dbase programmer (and I do mean (OLD!) so, while I am not a absolute beginner, PHP is another languange (though the syntax is somewhat related).

Here is what I want to do:

Without using frames I want to use the switch command to replace the majority of the screen on a rotating basis. Several years ago (maybe 4 or 5) I had the switch command working like this but some idiot newbie programmer at the webhost overwrote it and I didn't have it backed up.

If you go to www.stevenwjohnson.com you will see what I have now. What I want to do is add a left hand menu (easy enough to do in HTML) and have each individual book display on the majority of the page, incrementing the variable +1 for every view so people don't see the same book every time they visit the site. And every refresh will bring up a new book.

My problem is that for every 'sample' switch/case code I download I get nothing but the logo and the top and bottom menus.

Here is the code I have been playing with...

<?php
switch ($x) {
case 0:
echo "x equals 0";
break;
case 1:
echo "x equals 1";
break;
case 2:
echo "x equals 2";
break;
default:
echo "x is not equal to 0, 1 or 2";
}
?>

I realize somewhere I should increment x but I can't even get the default to echo.

HELP!!!

Seal
Seal is offline  
Reply With Quote