草庐IT

REALM_PARAM

全部标签

php - (double) $user_input 和 bind_param ('d' , $user_input 之间的安全差异

假设我要执行这样一个准备好的语句:$qry->prepare('UPDATEtable_nameSETcolumn1=?string_column=?WHEREcolumn3=?ANDcolumn4=?');$qry->bind_param('sbid',$string,$blob,$int,$double);$int='nonintvalue';/*gives0inthedatabase*/$blob='somestring';$string='anotherstring';$double=$double;$qry->execute();$qry->close();假设我只想执行一次

php - 如何使用带有数组作为第二个参数的 mysqli::bind_param

这个查询应该将一个新用户插入到“用户”表中$user=DB::getInstance()->insert('users',array('username'=>'jim','password'=>'pass','salt'=>'salt'));对应的insert()publicfunctioninsert($table,$fields=array()){if(count($fields)){$keys=array_keys($fields);$values=null;$x=1;foreach($fieldsas$field){$values.="?";if($xqueryDB($sql,

php - bind_param() 似乎不起作用

我有以下代码:connect_errno>0){die('Unabletoconnecttodatabase['.$db->connect_error.']');}else{echo"Connectedtodatabase";}//filename,mime_typeandfile_sizearecolumnsinthetableimages$stmt=$db->prepare("INSERTINTOimages(filename,mime_type,file_size)VALUES(?,?,?)");$string1='string1';$string2='string2';$stm

php - 在非对象 MySQLi 上调用成员函数 bind_param()

好的,所以我正在尝试更新博客条目,当我尝试运行脚本时,我正在调用非对象上的成员函数bind_param()。我进行了广泛的研究,看看是否可以自己修复它,但我一定遗漏了一些东西。prepare("UPDATEblogentriesSETheadline=?,image=?,caption=?,article=?WHEREid=?");$stmt->bind_param('ssssi',$_POST['headline'],$_POST['image'],$_POST['caption'],$_POST['article'],$_POST['id']);$stmt->execute();$

php - 通过 ODBC Sybase "PARAM datastream"错误的 PDO 准备语句

我正在尝试将一些旧的PHPODBC查询转换为PDO准备语句,但出现错误,我找不到太多相关信息。错误是:"[DataDirect][ODBCSybaseWireProtocoldriver][SQLServer]ThereisnohostvariablecorrespondingtotheonespecifiedbythePARAMdatastream.Thismeansthatthisvariable''wasnotusedintheprecedingDECLARECURSORorSQLcommand.(SQLExecute[3801]atext\pdo_odbc\odbc_stmt.

php - 为什么我们使用像 "call_user_func($callback,$param)"而不是 "$callback($param)"这样的代码

这个问题在这里已经有了答案:PHPcall_user_funcvs.justcallingfunction(8个答案)关闭9年前。PHP只是一种脚本语言,所以我们可以简单高效地做很多事情。为什么不使用像“$callback($param)”这样简单易行的方法呢?

php - Symfony2 和 Propel 包 : add additional filter to the Propel param converter

我在我的一个Controller中使用Propel参数转换器:(Symfony2.4.2+Propel1.7)*@ParamConverter("center",converter="propel",class="MyCompany\Bundle\CoreBundle\Model\Center")它运行良好,但我想添加额外的过滤器,通常是在字段isVisible上(但过滤器可能更复杂),这可能吗?事实上,我想要的是使用我的模型的自定义查询函数,而不是基本的findPk()函数。 最佳答案 如果你想指定用于查找实体的存储库方法,你可以

php - ( fatal error : Call to a member function bind_param() on a non-object)

这个问题在这里已经有了答案:Whattodowithmysqliproblems?Errorslikemysqli_fetch_array():Argument#1mustbeoftypemysqli_resultandsuch(1个回答)关闭4个月前。我收到此文本的错误:(抱歉我的英语不好,我来自德国!)错误:fatalerror:在第44行/users/ftf/www/ccache.php中的非对象上调用成员函数bind_param()部分代码来自ccache.php//NeuesDatenbank-Objekterzeugen$db=@newmysqli('localhost',

php - 在非对象上调用成员函数 bind_param()(尽管研究无法解决)

这个问题在这里已经有了答案:Whattodowithmysqliproblems?Errorslikemysqli_fetch_array():Argument#1mustbeoftypemysqli_resultandsuch(1个回答)关闭去年。$stmt=$mysqli->prepare('selectUnfrommemberwhereLock=?andActivated=?');$stmt->bind_param("ss",'N','Y');//Thislinegavetheerror$stmt->execute();$stmt->store_result();//applyt

php - PDO PARAM_STR 和长度

我不明白PDOPARAM_*语句中的长度选项。长度是否表示所需字符的数量,还是最大值?例子:$sth->bindParam(2,$color,PDO::PARAM_STR,12);这需要12个字符,还是限制为12个字符?或者,我是否完全误解了这是在做什么? 最佳答案 它表示您希望在输出参数中接收多少数据,服务器不会发送超过此数量的数据。因此,要回答您的问题,这是一个限制而非要求。 关于php-PDOPARAM_STR和长度,我们在StackOverflow上找到一个类似的问题: