php 语法错误,意外的 T_VARIABLE,需要 ',' 或 ';'在第 29 行 [英] php syntax error, unexpected T_VARIABLE, expecting ',' or ';' on line 29

查看:59
本文介绍了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 语法错误,意外的 T_VARIABLE,需要 ',' 或 ';'在线 29

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

推荐答案

您忘记了连接器:

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>
';

这篇关于php 语法错误,意外的 T_VARIABLE,需要 ',' 或 ';'在第 29 行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆