Error with mysqli_real_escape_string


I am running a php script in XAMPP (see below) and I am constantly getting this error:

Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, resource given in C:\xampp\htdocs\funstuff\signin.php on line 7

<?php session_start();
//check for session

	$username =mysqli_real_escape_string($dbc,trim($_POST['username']));
	//check to see if user is signed in
	$query="SELECT user_id,user_name FROM users WHERE user_name='$username' AND user_password=SHA('$password')";
		else{echo'no match';}


How about using mysqli_connect?

You have mixed up two libraries together related to mysql mysql and mysqli. So either you connect with mysqli_connect and use all the functions as you have used or connect to mysql server with mysql_connect and use all the functions of mysql_*.

as guido2004 said, you need to use msqli_connect() if you are going to use the functions in PHP’s mysqli extension to “talk” to your database.

Yeah, you need to be using mysqli_connect instead of mysql_connect!