Question
fatal error
i have this code :
<?php # Script 8.1 - mysql_connect.php
// This file contains the database access information.
// This file also establishes a connection to MySQL and selects the database. function.
// This file also defines the escape_data()
// Set the database access information as constants.
DEFINE ('DB_USER', 'therainb');
DEFINE ('DB_PASSWORD', 'twocats');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'therainb_Testingphp');
// Make the connection.
$dbc = @6688122_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );
// Select the database.
@6688122_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );
// Create a function for escaping the data.
function escape_data ($data) {
// Address Magic Quotes.
if (ini_get('magic_quotes_gpc')) {
$data = stripslashes($data);
}
// check for mysql_real_escape_string() support.
if (function_exists('mysql_real_escape_string')) {
global $dbc; // Need the connection.
$data = mysql_real_escape_string(trim($data), $dbc);
} else {
$data = mysql_escape_string(trim($data));
}
// Return the escaped value.
return $data;
} // End of function
?>
when i run it, i get this error :
Fatal error: Cannot redeclare escape_data() (previously declared in /home/therainb/public_html/myphp2/mysql_connect.php:20) in /home/therainb/public_html/myphp2/password.php on line 15
can someone help please?
<?php # Script 8.1 - mysql_connect.php
// This file contains the database access information.
// This file also establishes a connection to MySQL and selects the database. function.
// This file also defines the escape_data()
// Set the database access information as constants.
DEFINE ('DB_USER', 'therainb');
DEFINE ('DB_PASSWORD', 'twocats');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'therainb_Testingphp');
// Make the connection.
$dbc = @6688122_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );
// Select the database.
@6688122_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );
// Create a function for escaping the data.
function escape_data ($data) {
// Address Magic Quotes.
if (ini_get('magic_quotes_gpc')) {
$data = stripslashes($data);
}
// check for mysql_real_escape_string() support.
if (function_exists('mysql_real_escape_string')) {
global $dbc; // Need the connection.
$data = mysql_real_escape_string(trim($data), $dbc);
} else {
$data = mysql_escape_string(trim($data));
}
// Return the escaped value.
return $data;
} // End of function
?>
when i run it, i get this error :
Fatal error: Cannot redeclare escape_data() (previously declared in /home/therainb/public_html/myphp2/mysql_connect.php:20) in /home/therainb/public_html/myphp2/password.php on line 15
can someone help please?
