Ok, hello fellows, my first post here, and I'm kinda desperate (sorry if my english is bad, not my main language), anyway, I'm using ADOdb to make a IS, with PHP and Postgresql, now My system was working just fine with php version 5.2.5, I pulled from github my code, into my laptop, and installed a more recent version of php, and the $conn->Execute method did not work (yay), tryed downgrading the php version (wampserver) and still did not work, and the I said "hey, if it's not the php version I'll be an insane and upgrade the one in my main computer :D" long story short, I mess up, now the code does not work in any of my computer (again sarcastic yay), and the problem is that the Execute is not executing >.<... so here's my code, PLEASE PLEASE help, I don't see the problem... really (I haven't touch the database nor the code, just the wamp server...)
function loguear_coord($usuario,$contraseña,$conn) { $contraseña=sha1(md5($contraseña)); $query="SELECT * FROM users WHERE ((usuario LIKE '%$usuario%') AND (pass LIKE '%$contraseña%'))"; $result=$conn->Execute($query); if($result==false) { echo "error al insertar: ".$conn->ErrorMsg()."
" ; } else { while(!$result->EOF) { for ($i=0, $max=$result->FieldCount(); $i < $max; $i++) { $usuario2=$result->fields[5]; $nivel=$result->fields[2]; if($usuario == $result->fields[5]) { $id=2; /aquí hacer lo de la variable de sesion/ session_start(); $_SESSION['nivel']=$nivel; $_SESSION['usuario']=$usuario; $prueba1="OverNineThousand"; $prueba1=sha1(md5($prueba1));
$_SESSION['bandera']=$prueba1;} } $result->MoveNext(); } if($id==2) { header("location: ../coordinacion_principal.php"); } else { $id=1; header("location: ../index.php?id=$id"); } } $conn->Close();
}
//this is the case that calls the function
case 'Accesar':/*loguear en la coordinación*/ if(isset($_POST['usuario']) && isset($_POST['contraseña'])) { $usuario = $_POST['usuario']; $contraseña = $_POST['contraseña']; //var_dump($conn); loguear_coord($usuario,$contraseña,$conn); } /*and this is my conection to the database, that remember worked 'till yesterday*/ include('adodb5/adodb.inc.php'); $conn = ADONewConnection('postgres'); $conn->PConnect('host=localhost port=5432 dbname=Tesis user=postgres password=gamn2090'); if (!$conn) { echo "Error en la conexion.\n"; } $conn2 = ADONewConnection('postgres'); $conn2->PConnect('host=localhost port=5432 dbname=Control_de_estudios user=postgres password=gamn2090'); if (!$conn2) { echo "Error en la conexion.\n"; }
it works 'till the $conn->Execute($query); line u.u please help
Well I worked it out at last! it was the php version from wamp server, the wamp version that worked was the 1.7.4, and the php version is the 5.2.5, and the problem was that in the php setting and the php extensions I haven't selected the PDO_pgsql, and the pgsql, and it was not recongnizing the data base, I'm posting this hoping it will help some poor soul that have the same problem than me :)