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.

Little problem

Featured Replies

Hello all.

 

Got a little problem with my script.

 

Warning: mysqli_affected_rows() expects parameter 1 to be mysqli, boolean given in /home2/irn3rdc/public_html/gorsehill/public_html/user1/index.php on line 106

 

The above is the error I'm getting when i process my script.

 

if(empty($errors)) {//everything is okay
		// add the prodcut to the database.
$q = 'INSERT INTO product(prod_id, prod_name, prod_desc, prod_price, prod_imagename, prod_dim) VALUES (NULL,"'.$prod_name.'","'.$prod_desc.'","'.$prod_price.'","'.$i.'","'.$prod_dim.'")';
		$r = mysqli_query($dbc, $q);
		//check results
	line>  106      if (mysqli_affected_rows($r) == 1){
				//true
				$thankyou[] = 'The print has been added';

				//clear $_POST
				$_POST = array();
			}else{
				//error
				$errors[] = 'There has been a system error and your submission could not be processed';
			}
			mysqli_close($dbc);
	}//end of errors if

 

Line 106 is indicated, It is inserting the data into the database fine... just not like that mysqli_affected_rows if?

 

any ideas?

 

Ben

To quote from the php manual regarding the parameter you pass to mysqli_affected_rows():

Procedural style only: A link identifier returned by mysqli_connect()

In other words, assuming $dbc is the variable for mysqli_connect, use $dbc instead of $r as the parameter for mysqli_affected_rows.

 

 

  • Author

To quote from the php manual regarding the parameter you pass to mysqli_affected_rows():

 

In other words, assuming $dbc is the variable for mysqli_connect, use $dbc instead of $r as the parameter for mysqli_affected_rows.

ElanMan to the rescue once again, Owe you one mate

 

Worked like a charm :)

 

Ben

 

P.S , the penguin is a better look for you :p

P.S , the penguin is a better look for you :p

What was wrong with my other look?

I thought I looked really cool 8):D

  • Author

Penguin looks cooler, Should be Tux though :)

 

Would make it better IMO.

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.