Why isn't this working?
Date: 12/14/05
(PHP Community) Keywords: php, database
Just a small problem, but I'm going desperate here because I don't know what wrong. I'm pretty much a noob, you should know...
this script is for generating the sitetitle; if there's one set in the file it should take the one for the file (that part works), and if it's display.php, it should pull it from a database. The database one is not working, doesn't show anything....
Here's my code:
if (isset($sitetitle)) { echo " :: $sitetitle"; }
elseif ($_SERVER['PHP_SELF'] == "/www/htdocs/w005ab22/www/test/display.php"){
include('inc/connect.php');
$sql = "SELECT * FROM blog WHERE id='$id'";
$result = mysql_query($sql) or
print ("Can't select entries from table blog.
" . $sql . "
" . mysql_error());
while ($row = mysql_fetch_array($result))
{
$title = $row["title"];
$category = $row["category"];
echo " :: $title :: ($category)";
}
}
else echo "";
?>
Thanks in advance :)
Source: http://www.livejournal.com/community/php/379164.html