How does mysqli_stmt dynamically bind parameter values?

Source: Internet
Author: User
How does mysqli_stmt dynamically bind parameter values ???? The mysqli_stmt & nbsp; Method & nbsp; bind_param requires that all parameters be input at a time, which is equivalent to the number and order of parameters must be hard-coded, however, in practice, it may not be possible to obtain results. for example, when performing a query, the query statement may write mysqli_stmt to dynamically bind the parameter value ????
The mysqli_stmt method bind_param requires that all parameters be passed in at a time, which is equivalent to the number and order of parameters which must be hard-coded, but not necessarily possible.
For example, when performing a query, the query statement may be written like this.
$ SQL = "select * from mytable where price> 100 ";
If (....)
$ SQL. = "and price <? ";
If (....)
$ SQL. = "and createddate <? ";
If (....)
$ SQL. = "and employeeid =? ";
......

How should we pass in parameters?
You don't need to advise me how to improve the writing of SQL statements. there will be other similar SQL statements. here I am just an example. I just want to know how to set parameters dynamically.

Thank you! Share:
------ Solution --------------------
Call_user_func_array

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.