cypher86 Posted November 10, 2011 Author Share Posted November 10, 2011 that's ok 'cos that foreach is 1 instruction lenght and is just for debugging the $params array. Quote Link to comment https://forums.phpfreaks.com/topic/250765-warning-mysqli_stmtbind_param-mysqli-stmtbind-param/page/2/#findComment-1287086 Share on other sites More sharing options...
cypher86 Posted November 11, 2011 Author Share Posted November 11, 2011 i found this http://www.phpfreaks.com/forums/index.php?topic=269812.0. unfortunately now the problem is: Warning: call_user_func_array() expects parameter 2 to be array, integer given in ...... any help on this? Quote Link to comment https://forums.phpfreaks.com/topic/250765-warning-mysqli_stmtbind_param-mysqli-stmtbind-param/page/2/#findComment-1287334 Share on other sites More sharing options...
cypher86 Posted November 11, 2011 Author Share Posted November 11, 2011 attention please i've finally work it out. while (list($chiave,$val) = each($_POST)){ if($val!=""){ $fragments[] = $chiave." = ?"; //echo $chiave; if($chiave=="ritiro" or $chiave=="data") $params[] = normalToDbDate($val); else $params[] = $val; if($chiave=="legale") $type[]='i'; else $type[]='s'; } } $prova=implode("",$type); foreach($params as $param) echo "<p>".$param."</p>"; //echo "val(".count($params).")-->".implode(',',$params); //echo "type(".strlen($prova).")-->".implode("",$type); $sql = $db->prepare(".................. AND ".implode(" AND ", $fragments)); array_unshift($params,$prova); //print_r($params); $tmp = array(); foreach($params as $key => $value) $tmp[$key] = &$params[$key]; print_r($tmp); call_user_func_array( array( $sql, 'bind_param' ),$tmp); //$sql->bind_param($prova,$params); $sql->execute(); Quote Link to comment https://forums.phpfreaks.com/topic/250765-warning-mysqli_stmtbind_param-mysqli-stmtbind-param/page/2/#findComment-1287357 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.