Fatal error: Uncaught Error: Call to a member function bind_param() on boolean in

Trying to update but I get an error

    $imgData 		 = file_get_contents($filename);
	$imageProperties = getimageSize($filename);
	$status 		 = 'unverified';
	$status1		 = 'unpaid';
	
	$sqlblocks = "SELECT id FROM property WHERE block_lot_no = ? LIMIT 1";
	$queryblocks = $db->prepare($sqlblocks);		
	$queryblocks->bind_param("s",$_POST['block_lot_no']); 		
	$queryblocks->execute();
	$resultblocks = $queryblocks->get_result();
	$rowblocks = $resultblocks->fetch_assoc();
	 	
	if(!empty($rowblocks)) {
		array_push($errors,"This Block / Lot No already exists");
		}else{
			
	$sql ="UPDATE property (full_name,property_type, location, block_lot_no, imageType, imageData, status,status1,tax_payer_id) 
		VALUES (?,?,?,?,?,?,?,?,?)";
	
	$query = $db->prepare($sql);		
	errorpart->$query->bind_param("ssssssssi",$_REQUEST['full_name'] ,$_REQUEST['property_type'], $_REQUEST['location'], $_REQUEST['block_lot_no'], $imageProperties['mime'], $imgData, $status,$status1, $_SESSION['id']); 		
	$query->execute();
	$current_id = $query->insert_id;
	}

You are updating the table based on what?
There would usually a WHERE condition field with a value pointing to the record you wish to update. The UPDATE query is also written a little different than an INSERT query so please do some research on this and Post back if you need help.

1 Like

like this ?

$sql ="UPDATE property 
			SET full_name=?,property_type=?, location=?, block_lot_no=?, imageType=?, imageData=?, status,status1,tax_payer_id
			WHERE id=?";

You could always try that, observe the result, thereby confirming for yourself if it is correct or not.

What are you expecting to happen to these columns in your query? You don’t seem to assign any values to them.

What line of code is causing the error message? If it’s when you come to prepare the query, it often points to a syntax error in the query. Does your query work in phpmyadmin, obviously without the parameters?

Your UPDATE syntax is wrong

UPDATE *table_name*
SET *column1* = *value1* , *column2* = *value2* , ...
WHERE *condition* ;
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.