Home  >  Article  >  Backend Development  >  今天遇到了一个PHP有关问题,求朋友们帮帮谢了

今天遇到了一个PHP有关问题,求朋友们帮帮谢了

WBOY
WBOYOriginal
2016-06-13 12:05:23882browse

今天遇到了一个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;";
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php mysql 数据操作有关问题Next article:php 变量传递