[英]Mysql Date_format error
I always get this error message: 我总是收到此错误消息:
Parse error: syntax error, unexpected T_STRING in /myroot/public_html/test.php on line 5 解析错误:语法错误,第5行/myroot/public_html/test.php中的意外T_STRING
This is what the 5th line looks like: 这就是第5行的样子:
$sql = mysql_query("SELECT date_format(active,'%a/%b/%Y') AS active FROM members")
or die mysql_error();
I can't find anything wrong with the code as i copied it from another stackoverflow question 我找不到代码有什么问题,因为我从另一个stackoverflow问题中复制了它
Here's the whole script: 这是整个脚本:
$sql = mysql_query("SELECT date_format(active,'%a/%b/%Y') AS active FROM members") $ sql = mysql_query(“SELECT date_format(active,'%a /%b /%Y')AS FROM FROM members”)
or die mysql_error(); 或者死于mysql_error();
while ($results = mysql_fetch_assoc($sql)) { while($ results = mysql_fetch_assoc($ sql)){
$date = $results["active"]; $ date = $ results [“active”];
$user = $results["user"]; $ user = $ results [“user”];
} }
This is a PHP error but anyway.. Try changing 这是一个PHP错误,但无论如何..尝试更改
or die mysql_error();
to 至
or die (mysql_error());
Edit (forgot the obligatory 'don't use mysql_*' so here it is): 编辑(忘了强制'不要使用mysql_ *'所以这里是):
And please don't use the mysql_ functions in new code, they are deprecated. 请不要在新代码中使用mysql_函数,不推荐使用它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.