View Single Post
Old 08-18-2010, 12:46 PM   #2 (permalink)
tony
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

Ok, so you want to have a different layout and you only want to show 1 book and when they refresh the page you show another book, randomly. I don't think refreshing is a good way to navigate through the books if anything I would say instead of displaying 1, display them all downwards and just select randomly which is going to be at the top. Or am I understanding it badly?

About the switch code you posted, I tried it out and it work for me:
php Code:
<?php
$x = 5;
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 am wondering if the way you get the value of $x returns you a string because a string in a loose comparison (which is what the switch statement does) would be equal to 0.

P.S. It would be better if you are sharing code to wrap it in highlight tags.
tony is offline  
Reply With Quote