OK. In a database I have an ever changing index. I need it to generate a page for each one, like so:
index.php?page=1 , index.php?page=2
Is this a good way of going about this. I always get Unexpected T_CASE. I can't seem to get it to work!
if (isset($_GET['picture'])) {
$page=$_GET['picture'];
} else {
$page=0;
}
switch ($page) {
default:
echo "none";
break;
while($row = mysql_fetch_array($result)) {
case $row['id']:
echo $row['title];
break;
}
}
Try something like this:
while ($row = mysql_fetch_array($result))
{
if ($row['id'] == $page)
{
echo $row['title'];
}
}
On a completely unrelated note, you should cast $page to an int.
Thank you both for your input. Problem solved.
@Rabbit: I do.
You could probably get away with the way you did above with output buffering and eval, it would of been ugly though. As ugly as rabbit.
Below the belt, Mr. Mexican.
Hahaha <3.