Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Mysqli_STMT problem

Featured Replies

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?

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.