chaseman Posted December 22, 2010 Share Posted December 22, 2010 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? Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted December 22, 2010 Share Posted December 22, 2010 you need to connect to the db first, assigning $dbc BEFORE you use $dbc in mysqli_real_escape_string() Quote Link to comment Share on other sites More sharing options...
chaseman Posted December 22, 2010 Author Share Posted December 22, 2010 Ahh that was the last thought I had, but I wasn't sure if that's really the issue, thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.