2012-11-28 150 views
0

您可以注意到的任何問題?到目前爲止,對於我的測試,只要有疑問,我就會得到一個HTTP 500.我對PHP很陌生,可以儘可能獲得最多的幫助。MySQL忽略查詢請求

<?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

對不起,我是一個初學者,錯誤日誌的默認位置在哪裏? – James

+0

其中是$ pageid集? –

回答

0

嘗試:

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

謝謝你的回答,我的問題實際上是整個查詢情況。 – James

+0

這些命令是否需要函數成功?你會拿出所有查詢的東西,只是加載需求? 500錯誤?你是否能夠回顯所需文件中的值? – AllInOne

+0

當我拿出查詢的東西時,require與PHP都是好的,並且很漂亮 – James