Jump to content

inyachtcrew

New Members
  • Posts

    1
  • Joined

  • Last visited

inyachtcrew's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am trying to add in my php script named mysql_connect.php a way to send data to two separate databases at one time with the same scrip. I have tried many different ways to try this, and it either runs the error script or uploads successfully to only one of the two databases. Below is the script if anyone can help. Is there a way to make two database connections with one script? <?php DEFINE ('DB_USER', 'user'); DEFINE ('DB_PASSWORD', 'password'); DEFINE ('DB_HOST', 'my.server.name.com'); DEFINE ('DB_NAME', 'name'); // Make the connection. $dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL this time: ' . mysql_error() ); // Select the database. @mysql_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)); } if (function_exists('mysql_real_escape_string')) { global $other; // Need the connection. $data = mysql_real_escape_string (trim($data), $other); } else { $data = mysql_escape_string (trim($data)); } // Return the escaped value. return $data; } // End of function. ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.