今天遇到了一个PHP有关问题,求朋友们帮帮谢了
程序员文章站
2024-04-04 16:28:17
...
今天遇到了一个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 "
}
else{
echo "".$row['cat']."
";
}
}
require("footer.php");
?>
------解决方案--------------------
$entriessql="SELECT * FROM entries WHERE cat_id=".$validcat.
"ORDER BY dateposted DESC;";
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 "
- ";
- No entries! ";
- ".date("D jS F Y g.iA",strtotime($entriesrow['dateposted']))."- ".$entriesrow['subject']." ";
if($numrows_entries==0){
echo "
}
else{
while($entriesrow=mysql_fetch_assoc($entriesres)){
echo "
}
}
echo "
}
else{
echo "".$row['cat']."
";
}
}
require("footer.php");
?>
------解决方案--------------------
$entriessql="SELECT * FROM entries WHERE cat_id=".$validcat.
"ORDER BY dateposted DESC;";
相关文章
相关视频
上一篇: 用ckeditor发布文章,图片路径中多了"/"咋回事啊高手指教
下一篇: php 获取数据乱码问题