Ver Mensaje Individual
  #6 (permalink)  
Antiguo 07/05/2014, 17:09
castillo1
 
Fecha de Ingreso: abril-2014
Mensajes: 11
Antigüedad: 10 años, 1 mes
Puntos: 0
Respuesta: Como selecciono varios campos de una tabla

un ejemplo podria ser este:

Cita:
<?php
require_once("conexion.php");
$departamento=new departamento(0,'');
$departamento->lista_departamento();
$obcon= new Conexion();
$consulta = "select * from departamento";
$ejecquery = pg_query($obcon->Conectar(), $consulta);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title>usuarios</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="generator" content="Geany 0.20" />
</head>

<body>
<table border="1" bordercolor="#CCCCCC" cellspacing="0" cellpadding="0" align="center" width="704px">
<tr>
<td>ID</td>
<td>Departamento</td>
</tr>

<?php
while ($reg = pg_fetch_assoc($ejecquery)){
echo "<tr>
<td>".$reg['id_departamento']."</td>
<td>".$reg['nombre']."</td>
</tr>";
}

?>

</table>

</body>
</html>
espero que te sirva