Jump to content

mysqli_real_escape_string() Not Working Right!


chaseman

Recommended Posts

This works:

 

$name = mysqli_real_escape_string(mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME), trim($_POST['name']));

 

 

This DOESN'T work:

 

$name = mysqli_real_escape_string($dbc, trim($_POST['name']));

  // Connect to the database 
  $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

 

 

With the second version I get the error message "expects parameter 1 to be mysqli".

 

But parameter 1 IS mysqli, as you can see under $dbc.

 

So what's the deal?

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.