Jump to content

Recommended Posts

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.

Looks like the prepare() failed.

Put this line before your mysqli connection so that errors are trapped

mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT);

(if you don't have display_errors ON check your error log.)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.