Home > Article > Backend Development > 请教小弟我这里加的对吗
请问我这里加的对吗?
(intval(base64_decode($_GET[id])))"); 就是附近。。谢谢。
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phpif ($_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])) );<br><font color="#e78608">------解决方案--------------------</font><br>intval<br>base64_decode<br>都是php函数,就和上面说的。在字符串里面是无法解析的。<br><font color="#e78608">------解决方案--------------------</font><br>类似intval(base64_decode($_GET[id])) 这样的代码<br>单独写出来不好么,为什么要写在SQL里呢?因为省地方?<br><br>$id=intval(base64_decode($_GET[id]));<br>$sql_1=mysql_query("select * from $tbname_jihua where id ={$id}");<br><br>这样不清晰明了,而且你的问题也解决了...<div class="clear"> </div>