MySQL忽略查询请求

时间:2012-11-28 00:20:11

标签: php mysql database connection

您可以注意到的任何问题?到目前为止,在我的测试中,每当我有查询时,我都会得到一个HTTP 500.我是PHP的新手,可以获得尽可能多的帮助。

    <?php
require_once "dbConnect.php";
require "../www/showArticle.php";

$queryBodyCommand = "SELECT pbody FROM pages WHERE id='$pageid' LIMIT 1";
$queryBody = mysql_query($sqlConnect, $queryBodyCommand) or die (mysql_error()); 
while ($row = mysql_fetch_array($queryBody)) { 
    $body = $row["pbody"];
    $title = $row["title"];
}  
mysql_free_result($queryBody);

$queryLabelCommand = "SELECT id, label FROM pages WHERE showLabel ='1' AND enabled ='1' ORDER BY id ASC"; 
$queryLabel = mysql_query($sqlConnect, $queryLabelCommand) or die (mysql_error()); 
while ($row = mysql_fetch_array($queryLabel)) {
    $pid = $row["id"];
    $label = $row["label"];
    $menuList = '<a href="index.php?pid=' . $pid . '">' . $label . '</a><br />';
    } 
mysql_free_result($queryBody);

?>

这是我的showArticle.php:

<?php
require_once('../sub/dbConnect.php');
require('../sub/functions.php');
if (!$_GET['pid']) {
    $pageid = '1';
} else {
    $pageid = ereg_replace("[^0-9]", "", $_GET['pid']);
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title; ?></title>
</head>
<body>
<?php echo $title; ?>
Body:
<?php echo $body; ?>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

尝试:

require_once('dbConnect.php');
require('../www/showArticle.php');