Home > Backend Development > PHP Tutorial > mysqli_stmt 怎么动态绑定参数值?

mysqli_stmt 怎么动态绑定参数值?

WBOY
Release: 2016-06-13 11:24:01
Original
1061 people have browsed it

mysqli_stmt 如何动态绑定参数值????
mysqli_stmt 方法 bind_param,要求一次性把参数全部传入,相当于参数个数和次序必须是硬编码了,但是实际中不一定可以做得到
比如在做查询时,可能查询语句会这样写
$sql = " select * from mytable where price > 100";
if(....)
    $sql .= " and price if(....)
    $sql .= " and createddate if(....)
    $sql .= " and employeeid = ?";
......

这时应该如何传入参数?
大家不用建议我如何改进 sql 的写法,还将会有其它类似的 sql,我这里只是举个例子,只想知道有什么办法可以动态设置参数

谢谢!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template