简体   繁体   English

bind_param动态mysqli

[英]bind_param dynamically mysqli

I understand that: 我明白那个:

call_user_func_array(array(&$stmt, 'bindparams'), $array_of_params);

is what I need to do it, but I'm stuck. 是我需要做的,但是我被卡住了。

First off, I'd imagine they need the s and i still for each variable you're binding, and if so, I'm completely lost on how to actually do it. 首先,我想他们仍然需要s和i来绑定的每个变量,如果是这样,我将完全不知道如何实际执行此操作。 I had attempted at reading the variables with is_int and is_string , but it just wasn't working and was cutting off my actual variable value, and I'd need it to dynamically read if it's string or int at the least. 我曾尝试使用is_intis_string读取变量,但是它不起作用,并且切断了我的实际变量值,因此我至少需要它来动态读取它是字符串还是int。

If anyone could give me some example or point me to a site with an example I'd appreciate it. 如果有人可以给我一些示例,或将我指向带有示例的网站,我将不胜感激。 I've searched Google but can't seem to find anything on it really, and I've been looking for a few days now... 我已经搜索过Google,但似乎找不到真正的任何东西,而且我已经找了几天了...

I can supply my MySQLi class if needed. 如果需要,我可以提供我的MySQLi类。

Alright example That was all I could really find. 好例子那就是我真正能找到的全部。 It didn't work preparing and binding the statements unless it was an array great than 1 value, so you have to work it around to check if the value you passed in $params is an array or not, unless I was completely wrong. 除非它是一个大于1的值的数组,否则准备和绑定语句将不起作用,因此除非您完全错了,否则您必须解决它以检查在$ params中传递的值是否为数组。 Either way, I got it to work. 无论哪种方式,我都可以使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM