PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

请教小弟我这里加的对吗

原创
2016-06-13 10:16:22 571浏览

请问我这里加的对吗?
(intval(base64_decode($_GET[id])))"); 就是附近。。谢谢。

PHP code


------解决方案--------------------
字符串里包含的变量才被解析,函数名和常量不会被解析
PHP code
$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}");

这样不清晰明了,而且你的问题也解决了...
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。