Search the Community
Showing results for tags 'prepare statement'.
-
Hi, How do you split a search string by space and put it into a prepare query? $strings = $_POST['strings']; $string_array = explode(" ", $strings); $search = $mysqli->prepare(" SELECT * FROM core_table where item_name in ( ? ) "); $search->bind_param("s", $string_array); ...
- 6 replies
-
- search string
- split
-
(and 1 more)
Tagged with:
-
PHP Fatal error: Call to a member function prepare() on null
bbmak posted a topic in PHP Coding Help
Hi Trying to implement with the prepare statement, and it gives me this error. "PHP Fatal error: Call to a member function prepare() on null." Anybody knows what is wrong? function listMerchant() { $merchant = array(); $merchantList = $this->mysqli->prepare("SELECT * FROM core_merchant"); $merchantList->execute(); while($merchantRows = $merchantList->fetch_array()) { $merchant[] = $merchantRows; } $merchantList->close(); return $merchant; } -
I'm new to coding and prepared statements. I'm getting: "Fatal error: Call to a member function bind_param() on a non-object in /home/content/01/3251001/html/Manage-Users/acc-files/updateRecord.php on line 17" For this: <?php include "db_connect.php"; if(isset($_POST['UserID'])){ $stmt = $con -> prepare('UPDATE UserList SET Status = ?, FirstName = ?, LastName = ?, Username = ?, Email = ?, Department = ?, Manager = ?, WHERE UserID = ?'); $stmt -> bind_param('isssssss', /* Line 17 */ $_POST['Status'], $_POST['FirstName'], $_POST['LastName'], $_POST['Username'], $_POST['Email'], $_POST['Department'], $_POST['Manager'], $_POST['UserID']); $stmt->execute(); } Thank you in advance for helping.
-
Hello, I am trying to use array in bind statement to avoid entering bind manually Below, I set up the array, then imploded the array to insert , on it // to return 1,2,5 , but I got error Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables $arr = [1,2,5]; $arr_as_string = implode( ',',$arr); $type = 'iii'; $params = [$type,$arr_as_string]; $tmp = []; foreach($params as $key => $value) $tmp[$key] = &$params[$key]; call_user_func_array([$query, 'bind_param'], $tmp);
- 9 replies
-
- php
- bind_param
-
(and 1 more)
Tagged with: