今天遇到了一个PHP有关问题,求朋友们帮帮谢了
时间:2021-07-01 10:21:17
帮助过:14人阅读
今天遇到了一个PHP问题,求朋友们帮帮谢了
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in E:\amp\apache\htdocs\prod\viewcat.php on line 22
遇到这个错误,上网也没找到答案,麻烦你们能帮帮我解决哈,忠心感谢。
我的代码:
require("config.php");
if(isset($_GET['id'])==TRUE){
if(is_numeric($id)==FALSE){
$error=1;
}
if(isset($error)&&$error==1){
header("Location:".$config_basedir."/viewcat.php");
}
else{
$validcat=$_GET['id'];
}
}
else{
$validcat=0;
}
$sql="SELECT * FROM categories";
$result=mysql_query($sql);
while($row=mysql_fetch_assoc($result)){
if($validcat==$row['id']){
echo "
".$row['cat']."";
$entriessql="SELECT * FROM entries WHERE cat_id=".$validcat.
"ORDER BY dateposted DESC;";
$entriesres=mysql_query($entriessql);
$numrows_entries=mysql_nums_rows($entriesres);
echo "
";
if($numrows_entries==0){
echo "- No entries!
";
}
else{
while($entriesrow=mysql_fetch_assoc($entriesres)){
echo "- ".date("D jS F Y g.iA",strtotime($entriesrow['dateposted']))."- ".$entriesrow['subject']."
";
}
}
echo "
";
}
else{
echo "".$row['cat']."
";
}
}
require("footer.php");
?>
------解决方案--------------------$entriessql="SELECT * FROM entries WHERE cat_id=".$validcat.
"ORDER BY dateposted DESC
;";