VARIABLE,期待','或';' 在线29

我试图在简单的博客中回复我的数据库中的信息。 现在它不会工作。 无论我尝试。 我试图弄清楚自己,但我被困在一个单一的错误后面。

PHP的语法错误,意想不到的T_VARIABLE,期待','或';' 在线29

我只是找不到解决方案..希望你们能帮助我。 我在这里呆了几个小时,真的很疯狂。

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();

你忘了你的联合主义者:

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

应该

echo'
<span class="post">
    <h1>'.$result['title'].'</h1>
    <h2>'.$result['date'].'</h2>
    <p>'.$result['contents'].'</p>
    <h3>'.$result['author'].'</h3>
';
链接地址: http://www.djcxy.com/p/11961.html

上一篇: VARIABLE, expecting ',' or ';' on line 29

下一篇: syntax error, unexpected T