Ver Mensaje Individual
  #17 (permalink)  
Antiguo 23/06/2011, 14:31
toyimads
 
Fecha de Ingreso: junio-2011
Mensajes: 8
Antigüedad: 12 años, 10 meses
Puntos: 0
Respuesta: duda básica de PHP

Gracias, ahora veo algo mejor =), lo único que hice fué cambiar a comillas dobles "" el contenido de mysql_query; ahora mi script es este:

Cita:
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
[ OK ]
[root@freeswitch httpd]# vim /var/www/html/generos.php

<?php

$conexion = mysql_connect ('localhost','root','1234') or Die ("Error al conectar a base de datos ");

$bd = "biblioteca";

$con = mysql_select_db($bd,$conexion) or die ("Error al seleccionar BD");

$resultado = mysql_query("SELECT * FROM genero");

if (!$resultado) {
die ('Query invalida: ' . mysql_error());
}

while ($fila = mysql_fetch_row($resultado)) {

var_dump($fila);

echo '<br/>';
echo $fila[0];
echo '<br/>';
echo $fila[1];
echo '<br/>';
echo $fila[2];

}

mysql_free_result($resultado);
mysql_close($conexion);

?>
Y por web veo esto:

Cita:
array(3) { [0]=> string(1) "1" [1]=> string(2) "PM" [2]=> string(11) "PHP y MySQL" }
1
PM
PHP y MySQLarray(3) { [0]=> string(1) "2" [1]=> string(2) "OS" [2]=> string(12) "OpenSIPS 1.6" }
2
OS
OpenSIPS 1.6array(3) { [0]=> string(1) "3" [1]=> string(2) "DG" [2]=> string(12) "Asterisk TDG" }
3
DG
Asterisk TDG
No se ve muy bonito, pero ya se ve algo =)