日期:2014-05-17 浏览次数:20621 次
<?php
if($_GET[id]){
$sql_1=mysql_query("select * from $tbname_jihua where id =(intval(base64_decode($_GET[id])))");
}else{
$sql=mysql_query("select * from $tbname_jihua");
}
?>
$id = intval(base64_decode($_GET[id]));
$sql_1=mysql_query("select * from $tbname_jihua where id = {$id}");
// or
$sql_1=mysql_query("select * from $tbname_jihua where id = ". intval(base64_decode($_GET[id])) );
------解决方案--------------------
intval
base64_decode
都是php函数,就和上面说的。在字符串里面是无法解析的。
------解决方案--------------------
类似intval(base64_decode($_GET[id])) 这样的代码
单独写出来不好么,为什么要写在SQL里呢?因为省地方?
$id=intval(base64_decode($_GET[id]));
$sql_1=mysql_query("select * from $tbname_jihua where id ={$id}");
这样不清晰明了,而且你的问题也解决了...