dsgwdigu84950 2013-01-30 14:16
浏览 27

php语法错误,意外T_VARIABLE,期待','或';' 29号线[关闭]

I'm trying to echo my information from my database in a simple blog. Now it just won't work. Whatever I try. I'm trying to figure it out myself but I am stuck behind a single error.

php syntax error, unexpected T_VARIABLE, expecting ',' or ';' on line 29

I just can't find a solution for it.. Hope you guys can help me. I am getting pretty insane of being stuck for hours here.

require('config.inc.php');
require('template.inc.php');
require('functions.inc.php');

$db_host = "***********";
$db_username = "************0";
$db_pass = "*********";
$db_name = "****************";

@mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to        mysql");
@mysql_select_db("$db_name") or die ("no database");

$title=$_POST['title'];
$contents=$_POST['contents'];
$author=$_POST['author'];
$date=$_POST['date'];
$date = strftime("%b %d, %y", strtotime($date));

$sqlcreate = mysql_query("INSERT INTO blog (date, title, contents, author)
            VALUES(now(),'$title','$contents','$author')");
$query="SELECT * FROM tablename";
$result=mysql_query($query);
htmlOpenen('Voeg nieuwe post toe');
while ($result=mysql_query($query) ) {
echo'
<span class="post">
    <h1>'$result['title'];'</h1>
    <h2>'$result['date'];'</h2>
    <p>'$result['contents'];'</p>
    <h3>'$result['author'];'</h3>
';
}
htmlSluiten();
mysql_close();
  • 写回答

1条回答 默认 最新

  • dongling2038 2013-01-30 14:17
    关注

    You forgot your concatentors:

    echo'
    <span class="post">
        <h1>'$result['title'];'</h1>
        <h2>'$result['date'];'</h2>
        <p>'$result['contents'];'</p>
        <h3>'$result['author'];'</h3>
    ';
    

    should be

    echo'
    <span class="post">
        <h1>'.$result['title'].'</h1>
        <h2>'.$result['date'].'</h2>
        <p>'.$result['contents'].'</p>
        <h3>'.$result['author'].'</h3>
    ';
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大