PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
if(isset($sec)) { $sql = "SELECT * FROM posts WHERE id='$id' AND section='$sec' ORDER BY id DESC"; }
elseif($sec == "showall") {
$sql = "SELECT * FROM posts WHERE id='$id' ORDER BY id DESC";
}
var_dump($sec) shows that showall is indeed set.
I also changed it to 1 = 1 just to see and it still wouldn't work.
if($i > 1)
{
// Do something
}
else if ($i > 2)
{
// If $i isn't bigger than 1, it's not bigger than 2
// and if it is bigger than 1, it'll never get here
}
if(isset($sec))
{
if ($sec == 'showall')
{
$sql = "SELECT * FROM posts WHERE id='$id' ORDER BY id DESC";
} else {
$sql = "SELECT * FROM posts WHERE id='$id' AND section='$sec' ORDER BY id DESC";
}
} else {
// $sec is not set
}