Page 1 of 1

mysql_escape_string

Posted: Tue Apr 20, 2004 1:24 pm
by ehause
Hi all:

I'm using MySQL 4.0.18, trying to run the mysql_escape_string on my form variables, and when I submit the form, I get this error one time for each var I'm apllying the string to:

Warning: Wrong parameter count for mysql_escape_string() in /home/souther2/public_html/register.php on line 18

Here's the code for the string:

// Create a function for escaping the data.
function escape_data ($data) {
global $dbc; // Need the connection.
if (ini_get('magic_quotes_gpc')) {
$data = stripslashes($data);
}
return mysql_escape_string($data, $dbc);
} // End of function.

And here's how I'm applying it to the variables:

$fn = escape_data($_POST['first_name']);

Any ideas? Thanks in advance!

Posted: Tue Apr 20, 2004 1:37 pm
by BDKR

Code: Select all

// Create a function for escaping the data. 
function escape_data ($data) 
    { 
    if (ini_get('magic_quotes_gpc')) 
        { $data = stripslashes($data); } 
    return mysql_escape_string($data); 
    } // End of function.
mysql_escape_string only takes one argument. That's what the error message was about. Go to php.net and check the manual.

Cheers,
BDKR