带有准备好的语句的 PDO bindParam() 不起作用
本文介绍了带有准备好的语句的 PDO bindParam() 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的,这就是问题所在:
这有效:
这不会:
我到底做错了什么?它甚至不抛出异常
谢谢大家!
另外,这是完整的代码
解决方案
使用 bindParam()
变量是 绑定为引用.
字符串不能通过引用传递.>
可以通过引用传递以下内容:
<块引用>变量,即 foo($a)
新语句,即 foo(new foobar())
从函数返回的引用
尝试使用 bindValue()
Ok, this is the problem:
This works:
This doesn't:
What in the world am I doing wrong? It doesn't even throw an exception
Thank you everyone!
Also, this is the whole code
解决方案
Using bindParam()
the variable is bound as a reference.
A string can't be passed by reference.
The following things can be passed by reference:
Variables, i.e. foo($a)
New statements, i.e. foo(new foobar())
References returned from functions
Try using bindValue()
这篇关于带有准备好的语句的 PDO bindParam() 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!