You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

36 lines
1.3 KiB

  1. <?php
  2. /*
  3. Author:XM
  4. Compeny:Spiders Travel
  5. */
  6. require_once __DIR__.'/Config.php';
  7. require_once __DIR__.'/Function.php';
  8. require_once __DIR__.'/sinaAPI.php';
  9. function conn1(){
  10. $port=defined('MYSQL_PORT')?MYSQL_PORT:3306;
  11. try {
  12. $pdo=new PDO("mysql:host=".MYSQL_HOST.";port=".$port.";dbname=".MYSQL_DB, MYSQL_USER, MYSQL_PASSWORD,array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));
  13. return $pdo;
  14. }catch (PDOException $e){
  15. writeLog('new PDO failed:'.$e->getMessage());
  16. }
  17. }
  18. function conn(){
  19. $port=defined('MYSQL_PORT')?MYSQL_PORT:3306;
  20. try {
  21. $pdo=new PDO("mysql:host=".MYSQL_HOST.";port=".$port.";dbname=waice", MYSQL_USER, MYSQL_PASSWORD,array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));
  22. // $pdo=new PDO("mysql:host=".MYSQL_HOST.";port=".$port.";dbname=ctsdata", MYSQL_USER, MYSQL_PASSWORD,array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));
  23. return $pdo;
  24. }catch (PDOException $e){
  25. writeLog('new PDO failed:'.$e->getMessage());
  26. }
  27. }
  28. function conn2(){
  29. $port=defined('MYSQL_PORT2')?MYSQL_PORT2:3306;
  30. try {
  31. $pdo=new PDO("mysql:host=".MYSQL_HOST2.";port=".$port.";dbname=".MYSQL_DB2, MYSQL_USER2, MYSQL_PASSWORD2,array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));
  32. return $pdo;
  33. }catch (PDOException $e){
  34. writeLog('new PDO failed:'.$e->getMessage());
  35. }
  36. }