Advertisement
Guest User

Untitled

a guest
Sep 16th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.68 KB | None | 0 0
  1. <?PHP
  2. /*
  3. Coder: Merrick Fenkohl
  4. Moves specific Fields from one MYSQL server to another
  5. */
  6. set_time_limit(10800); // Three hour timeout
  7. $db1 = new makeConnection;
  8. $db1->setConnectionParameters('10.0.1.192', 'root', 'password' , 'skynet');
  9. if ('0' != ($db1c = $db1->makeConnection()))
  10.     echo "connection successfull";
  11. else
  12.     echo $db1->getError();
  13. $query = mysql_query("SELECT * FROM rootDir") or die ("error with query");
  14. while ($row = mysql_fetch_array($query)){
  15. print_r($row);
  16.     }
  17. echo "test";
  18. sleep(500);
  19.  
  20.  
  21.  
  22. class makeConnection{
  23.     private $serverName;
  24.     private $schemaName;
  25.     private $userName;
  26.     private $password;
  27.     public $mysqlResource;
  28.    
  29.     function setConnectionParameters($s, $u, $p, $sch){
  30.       $this->serverName = $s;
  31.       $this->userName = $u;
  32.       $this->password = $p;
  33.       $this->schemaName = $sch;
  34.     }
  35.    
  36.     function makeConnection(){  
  37.         if (false === ($this-> mysqlResource = mysql_connect($this->serverName, $this->userName, $this->password)))
  38.             return '0';
  39.         if (false === mysql_select_db($this->schemaName))
  40.             return '0';
  41.         return $this-> mysqlResource;
  42.     }
  43.    
  44.     function destroyConnection(){
  45.         if (true === mysql_close($this->mysqlResource))
  46.             return '1';
  47.         else
  48.             return '0';
  49.     }
  50.    
  51.     function getError(){
  52.         return mysql_error($this-> mysqlResource);
  53.     }
  54.    
  55. }
  56.  
  57.  
  58. ?>
  59.  
  60.  
  61. [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
  62. [10-Jun-2011 11:56:31] PHP Warning:  mysql_connect(): No connection could be made because the target machine actively refused it.
  63.  in H:\past Scripts\mysqlMover.php on line 34
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement