December 11, 201015 yr I started using prepared statements, done some few examples and now I am having some problems with the following code $q='INSERT INTO prints(artist_id,print_name,price,size,description,image_name) VALUES(?,?,?,?,?,?)'; $stmt=mysqli_prepare($dbc,$q); mysqli_stmt_bind_param($stmt,'isdsss',$a,$pn,$p,$s,$d,$i); mysqli_stmt_execute($stmt); and I get this error mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given ofc I checked the manual and it was pointed out that i need to use mysqli_stmt_init function, but I used that too and got the same errors any help?
December 11, 201015 yr mysqli_prepare will return false when an error occurred with it, and mysqli_stmt_bind_param is just reporting that its being provided with a 'false' rather than a mysqli_prepare resource. So the problem likely lies with your query. Try using quotes to see if that helps $q='INSERT INTO `prints` (`artist_id`, `print_name`, `price`, `size`, `description`, `image_name` ) VALUES(?, ?, ?, ?, ?, ?)'; $stmt=mysqli_prepare($dbc,$q); mysqli_stmt_bind_param($stmt,'isdsss',$a,$pn,$p,$s,$d,$i); mysqli_stmt_execute($stmt);
Create an account or sign in to comment