Foros del Web » Programando para Internet » PHP »

Conexion php a mysql en 000webhost?

Estas en el tema de Conexion php a mysql en 000webhost? en el foro de PHP en Foros del Web. No me puedo conectar a 00webhost y anteriormente si podia acaso se ha modificado al phpmyadmin? En el server local me funciona bien y al ...
  #1 (permalink)  
Antiguo 13/07/2009, 15:31
 
Fecha de Ingreso: enero-2008
Ubicación: Lima - Perú
Mensajes: 1.127
Antigüedad: 16 años, 3 meses
Puntos: 10
Conexion php a mysql en 000webhost?

No me puedo conectar a 00webhost y anteriormente si podia acaso se ha modificado al phpmyadmin?
En el server local me funciona bien y al subirlo a 000webhost con los datos de acceso que me dieron me salen estos errores

Código:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a3616285/public_html/a.php on line 17

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/a3616285/public_html/a.php on line 26
Código PHP:
<html>
<head>
<title>Reporte de Ciudades</title>
</head>
<body>
<h1>Reporte de Ciudades</h1>
<table border="1">
<tr>
<td>ID Ciudad</td>
<td>Nombre</td>
</tr> 

<?php
$conexion 
mysql_connect('mysql8.000webhost.com','a3616285_db,'clave');
mysql_select_db('
a3616285_db');
$tabla = mysql_query('
SELECT FROM ciudades');
while ($registro = mysql_fetch_array($tabla)) 
{  
?>
<tr>
<td><?php echo $registro['
id']; ?></td>
<td><?php echo $registro['
nombre]; ?></td>
</tr> 
<?php
}
mysql_free_result($tabla);
mysql_close($conexion);
?>
</table>
</body>
</html>
  #2 (permalink)  
Antiguo 13/07/2009, 15:41
 
Fecha de Ingreso: septiembre-2008
Mensajes: 350
Antigüedad: 15 años, 7 meses
Puntos: 31
Respuesta: Conexion php a mysql en 000webhost?

Hola lo único que veo es que le faltan unas comillas de sierre.
prueba así:

Código PHP:
<html>
<head>
<title>Reporte de Ciudades</title>
</head>
<body>
<h1>Reporte de Ciudades</h1>
<table border="1">
<tr>
<td>ID Ciudad</td>
<td>Nombre</td>
</tr> 

<?php
$conexion 
mysql_connect('mysql8.000webhost.com','a3616285_db','clave');
mysql_select_db('a3616285_db');
$tabla mysql_query('SELECT * FROM ciudades');
while (
$registro mysql_fetch_array($tabla)) 
{  
?>
<tr>
<td><?php echo $registro['id']; ?></td>
<td><?php echo $registro['nombre']; ?></td>
</tr> 
<?php
}
mysql_free_result($tabla);
mysql_close($conexion);
?>
</table>
</body>
</html>
__________________
╬-----╬
║☺₧☻║
╬-----╬
  #3 (permalink)  
Antiguo 13/07/2009, 16:17
 
Fecha de Ingreso: enero-2008
Ubicación: Lima - Perú
Mensajes: 1.127
Antigüedad: 16 años, 3 meses
Puntos: 10
Respuesta: Conexion php a mysql en 000webhost?

Asi esta y sigue igual no sepor que no aparecieron esas comillas al inciar el post.
He creado un nueva base de datos y nada
Código PHP:
<html> 
<head> 
<title>Reporte de Ciudades</title> 
</head> 
<body> 
<h1>Reporte de Ciudades</h1> 
<table border="1"> 
<tr> 
<td>ID Ciudad</td> 
<td>Nombre</td> 
</tr>  

<?php 
$conexion 
mysql_connect('mysql8.000webhost.com','a3616285_word','133778'); 
mysql_select_db('a3616285_word'); 
$tabla mysql_query('SELECT * FROM ciudades'); 
while (
$registro mysql_fetch_array($tabla))  
{   
?> 
<tr> 
<td><?php echo $registro['id']; ?></td> 
<td><?php echo $registro['nombre']; ?></td> 
</tr>  
<?php 

mysql_free_result($tabla); 
mysql_close($conexion); 
?> 
</table> 
</body> 
</html>
  #4 (permalink)  
Antiguo 13/07/2009, 17:08
 
Fecha de Ingreso: mayo-2009
Mensajes: 50
Antigüedad: 14 años, 10 meses
Puntos: 1
Respuesta: Conexion php a mysql en 000webhost?

Cita:
Iniciado por franko1809 Ver Mensaje
Asi esta y sigue igual no sepor que no aparecieron esas comillas al inciar el post.
He creado un nueva base de datos y nada
Código PHP:
<html> 
<head> 
<title>Reporte de Ciudades</title> 
</head> 
<body> 
<h1>Reporte de Ciudades</h1> 
<table border="1"> 
<tr> 
<td>ID Ciudad</td> 
<td>Nombre</td> 
</tr>  

<?php 
$conexion 
mysql_connect('mysql8.000webhost.com','a3616285_word','133778'); 
mysql_select_db('a3616285_word'$conexion); 
$tabla mysql_query('SELECT * FROM ciudades'); 
while (
$registro mysql_fetch_array($tabla))  
{   
?> 
<tr> 
<td><?php echo $registro['id']; ?></td> 
<td><?php echo $registro['nombre']; ?></td> 
</tr>  
<?php 

mysql_free_result($tabla); 
mysql_close($conexion); 
?> 
</table> 
</body> 
</html>
te falto poner la variable $conexion

saludos
  #5 (permalink)  
Antiguo 13/07/2009, 17:18
 
Fecha de Ingreso: enero-2008
Ubicación: Lima - Perú
Mensajes: 1.127
Antigüedad: 16 años, 3 meses
Puntos: 10
Respuesta: Conexion php a mysql en 000webhost?

Ya la coloque, pero en local si me funciona todo bien
mysql_select_db('a3616285_word', $conexion);
$tabla = mysql_query('SELECT * FROM ciudades', $conexion);
he probado de varias formas y sigue el mismo error me parece que hay mal con mysql de 000webhost
  #6 (permalink)  
Antiguo 13/07/2009, 18:20
 
Fecha de Ingreso: septiembre-2008
Mensajes: 350
Antigüedad: 15 años, 7 meses
Puntos: 31
Respuesta: Conexion php a mysql en 000webhost?

has una prueba algo así como esto haber que te devuelve.
Código PHP:
 <?php 
$conexion 
mysql_connect("mysql8.000webhost.com","a3616285_db","clave");
if (!
$conexion){
die(
'Error '.mysql_error());
}else{
echo 
'No Error';
}
?>
__________________
╬-----╬
║☺₧☻║
╬-----╬
  #7 (permalink)  
Antiguo 13/07/2009, 19:00
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Respuesta: Conexion php a mysql en 000webhost?

Si te esta fallando algo así de básico, te recomendaría levantar un ticket de soporte en tu hosting para que te verifiquen el porque del fallo.

Saludos.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:11.