Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- /*
- Coder: Merrick Fenkohl
- Moves specific Fields from one MYSQL server to another
- */
- set_time_limit(10800); // Three hour timeout
- $db1 = new makeConnection;
- $db1->setConnectionParameters('10.0.1.192', 'root', 'password' , 'skynet');
- if ('0' != ($db1c = $db1->makeConnection()))
- echo "connection successfull";
- else
- echo $db1->getError();
- $query = mysql_query("SELECT * FROM rootDir") or die ("error with query");
- while ($row = mysql_fetch_array($query)){
- print_r($row);
- }
- echo "test";
- sleep(500);
- class makeConnection{
- private $serverName;
- private $schemaName;
- private $userName;
- private $password;
- public $mysqlResource;
- function setConnectionParameters($s, $u, $p, $sch){
- $this->serverName = $s;
- $this->userName = $u;
- $this->password = $p;
- $this->schemaName = $sch;
- }
- function makeConnection(){
- if (false === ($this-> mysqlResource = mysql_connect($this->serverName, $this->userName, $this->password)))
- return '0';
- if (false === mysql_select_db($this->schemaName))
- return '0';
- return $this-> mysqlResource;
- }
- function destroyConnection(){
- if (true === mysql_close($this->mysqlResource))
- return '1';
- else
- return '0';
- }
- function getError(){
- return mysql_error($this-> mysqlResource);
- }
- }
- ?>
- [10-Jun-2011 11:56:31] PHP Warning: mysql_connect(): [2002] No connection could be made because the target machine actively (trying to connect via tcp://localhost:3306) in H:\past Scripts\mysqlMover.php on line 34
- [10-Jun-2011 11:56:31] PHP Warning: mysql_connect(): No connection could be made because the target machine actively refused it.
- in H:\past Scripts\mysqlMover.php on line 34
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement