View Single Post
Old 02-03-2009, 07:50 PM   #1 (permalink)
nefus
The Contributor
 
nefus's Avatar
 
Join Date: Nov 2007
Location: Nashville, TN
Posts: 66
Thanks: 20
nefus is on a distinguished road
Confused mysql_real_escape_string?

Heya guys. I am truly puzzled by mysql_real_escape_string.

From what I understand you need to make a database connection before the function will work. I think that I'm doing this.
Code:
$link = mysqli_connect( $sql_server, $sql_user , $sql_password ) or die ('Unable to connect to server.'. mysqli_error());

mysqli_select_db( $link, $sql_database ) or die ('Unable to select database.'. mysqli_error());

$username 	= mysql_real_escape_string($username, $link);
$password 	= mysql_real_escape_string($password);
The $username line gives me error:
Warning: mysql_real_escape_string() expects parameter 2 to be resource...

The $password line gives me another error.
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in...

I would think one of these would work, suggestions??
nefus is offline  
Reply With Quote