Guest User

Untitled

a guest
Feb 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. $bd = $conexiones_db[$clave_con]['parametros']['bd'];
  2. $host = $conexiones_db[$clave_con]['parametros']['host'];
  3. $user = $conexiones_db[$clave_con]['parametros']['user'];
  4. $pass = $conexiones_db[$clave_con]['parametros']['pass'];
  5. $bdname = $conexiones_db[$clave_con]['parametros']['bdname'];
  6. $port = isset($conexiones_db[$clave_con]['parametros']['port'])?$conexiones_db[$clave_con]['parametros']['port']:'';
  7.  
  8. if($bd=='postgres' || $port==''){
  9. $GLOBALS["con"] = NewADOConnection($bd);
  10. $GLOBALS["con"]->Connect($host, $user, $pass, $bdname) or errorConexion($bd,$host,$user,$bdname);
  11. }
  12. else{
  13. $cstr = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=".$host.")(PORT=".$port."))(CONNECT_DATA=(SID=".$bdname.")))";
  14. $GLOBALS["con"] = NewADOConnection($bd);
  15. $GLOBALS["con"]->Connect($cstr, $user,$pass);
  16. }
  17. $GLOBALS["con"]->SetFetchMode(ADODB_FETCH_ASSOC);
Add Comment
Please, Sign In to add comment