"mysqli_fetch_assoc() expects parameter / call to a member function bind_param() errors. how to get the actual mysql error and fix it?" Code Answer

2
$query = $this->db->conn->prepare('SELECT value, param FROM ws_settings WHERE name = ?');
$query->bind_param('s', $setting);

The prepare() method can return false and you should check for that. As for why it returns false, perhaps the table name or column names (in SELECT or WHERE clause) are not correct?

Also, consider use of something like $this->db->conn->error_list to examine errors that occurred parsing the SQL. (I'll occasionally echo the actual SQL statement strings and paste into phpMyAdmin to test, too, but there's definitely something failing there.)

By EzzDev on July 7 2022
0
<?php
$fname = "John"
$lname = "Doe";
$email = "johndoe@gmail.com";
$userid = 5;
$con = new mysqli("servername", "db_username", "db_password", "db_name");
$stmt = $con->prepare("UPDATE users SET first_name = ?, last_name = ?, email = ? WHERE id = ?");
$stmt->bind_param("sssi", $fname, $lname, $email, $userid);
$stmt->execute();

By sociallymellow on October 26 2022

Answers related to “mysqli_fetch_assoc() expects parameter / call to a member function bind_param() errors. how to get the actual mysql error and fix it?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.