有谁知道这个PHP错误消息背后的含义? [英] Does anyone know the meaning behind this php error message?
本文介绍了有谁知道这个PHP错误消息背后的含义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解析错误:语法错误,意外的T_ENCAPSED_AND_WHITESPACE,预计消息为T_STRING或T_VARIABLE或T_NUM_STRING.它来自以下代码行:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING is the message. It came up from this line of code:
$query = ("SELECT *
FROM users
WHERE user_name = $_POST['user_name']
& password = $_POST['password']
& user_type = $_POST['user_type']");
外面有人知道这一切的意思吗?如果是这样,有人知道如何处理吗?
Does anyone out there know the meaning of all this? If so, does anyone know how to deal with this?
推荐答案
使用:
$query = sprintf("SELECT u.*
FROM USERS u
WHERE u.user_name = '%s'
AND u.password = '%s'
AND u.user_type = '%s' ",
mysql_real_escape_string($_POST['user_name']),
mysql_real_escape_string($_POST['password']),
mysql_real_escape_string($_POST['user_type']) );
$result = mysql_query($query);
参考
- sprintf
- sprintf
Reference
这篇关于有谁知道这个PHP错误消息背后的含义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文