PRUEBA

[insert_php] $conn_string = "host=213.98.61.51 port=5432 dbname=arcadia_cbos user=infjun password=Juncaril15!";
$Conn = pg_connect($conn_string);
$sqltxt ="SELECT soldable_soldableid,amount,validitystart FROM price WHERE soldable_soldableid='1863' OR soldable_soldableid='1875' OR soldable_soldableid='1870' OR soldable_soldableid='1880' OR soldable_soldableid='1885' ORDER by validitystart DESC LIMIT 6;";
$result = pg_query ($Conn, $sqltxt ) or die("Error en la consulta SQL");
$registros= pg_num_rows($result);
//mostrando resultados

for ($i=0;$i<$registros;$i++) { $row = pg_fetch_array ( $result,$i); if($row["soldable_soldableid"]=="1863"){ echo "Diesel - "; }else if($row["soldable_soldableid"]=="1875"){ echo "ADblue - "; }else if($row["soldable_soldableid"]=="1870"){ echo "Diesel Premiun - "; }else if($row["soldable_soldableid"]=="1880"){ echo "Gasolina - "; }else{ echo "GLP - "; } echo $row["amount"]." | "; echo "Fecha Publicacion : ".$row["validitystart"]; echo "
";
}

pg_free_result($result);
pg_close($Conn);

[/insert_php].

×