PHP新的托管与双引号错误
在我所有的PHP脚本都正常工作之前,我只是更换了我的主机
但现在我得到了很多像这样的mysql错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near column = 'value'
在某些剧本中似乎有一个双引号
有没有更新所有我的PHP脚本解决方法?
编辑:PHP代码的例子
function test( $table,$column, $where ){
if( get_magic_quotes_gpc() ) { $where = strip_tags( trim( $where ) ); }
else{ $where = strip_tags( mysql_real_escape_string( trim( $where ) ) ); }
$where = "AND id = '" . $where . "' ";
$query = "SELECT " . $column . " FROM " . $table . " WHERE 1 " . $where . " LIMIT 1";
//...
您必须传递$table
变量或将其声明为全局变量(如果在外部定义的话)。
function test( $column, $where ){
global $table;
if( get_magic_quotes_gpc() ) { $where = strip_tags( trim( $where ) ); }
else{ $where = strip_tags( mysql_real_escape_string( trim( $where ) ) ); }
$where = "AND id = '" . $where . "' ";
$query = "SELECT " . $column . " FROM " . $table . " WHERE 1 " . $where . " LIMIT 1";
如果你的功能看起来如此,会发生什么?
function test( $table,$column, $where ){
$where=stripslashes($where);
$where = strip_tags(mysql_real_escape_string(trim( $where )));
$where = "AND id = '" . $where . "' ";
$query = "SELECT " . $column . " FROM " . $table . " WHERE 1 " . $where . " LIMIT 1";
}
链接地址: http://www.djcxy.com/p/69555.html