Foros del Web » Programando para Internet » PHP »

2 errores en mysqli_fetch_array()

Estas en el tema de 2 errores en mysqli_fetch_array() en el foro de PHP en Foros del Web. envio los datos del formulario insert_formulario.html a insert.php tengo un formulario insert_formulario.html Código HTML: <html> <body> <form method= "post" action= "insert.php" > id_usuario: <input type= ...
  #1 (permalink)  
Antiguo 26/10/2010, 04:11
 
Fecha de Ingreso: febrero-2009
Mensajes: 443
Antigüedad: 15 años, 2 meses
Puntos: 1
2 errores en mysqli_fetch_array()

envio los datos del formulario insert_formulario.html a insert.php

tengo un formulario insert_formulario.html
Código HTML:
<html>
    <body>
        <form method="post" action="insert.php">
            id_usuario:<input type="text" name="id_usuario" size="30"><br>
            Nombre:<input type="text" name="nombre" size="30"><br>
            apellidos:<input type="text" name="apellidos" size="30"><br>
            telefono:<input type="text" name="telefono" size="30"><br>
            Mail:<input type="text" name="mail" size="30"><br>
            <input type="submit" name="enviar" value="Aceptar informacion">
        </form>
    </body>
</html> 

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /var/www/html/php/m/insert.php on line 20

Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in /var/www/html/php/m/insert.php on line 30

Código PHP:
<?php

$id_usuario
=$_POST["id_usuario"];
$nombre=$_POST["nombre"];
$apellidos=$_POST["apellidos"];
$telefono=$_POST["telefono"];
$email=$_POST["email"];

    include(
'select/select.php');
    
$link mysqli_connect($hostname,$user,$password,$database);


    
$query "insert into usuari (id_usuario,nombre,apellidos,telefono,email) values ('$id_usuario','$nombre','$apellidos,'$telefono','$email')";
      
    
mysqli_query ($link,'SET NAMES "utf8" ');
    
$result mysqli_query($link,$query);
/* associative array */
    
while ($row mysqli_fetch_array($resultMYSQLI_ASSOC)){

        echo    
$row['id_usuario'];
echo    
$row['nombre'];
        echo    
$row['apellidos'];

    echo    
$row['telefono'];
        echo    
$row['email'];
    }
     
/* free result set */
mysqli_free_result($result);
/* close connection */
mysqli_close($link);
?>

aparte de los errores
se puede hacer un select después de haber echo el insert en el fichero insert.php
  #2 (permalink)  
Antiguo 26/10/2010, 05:15
 
Fecha de Ingreso: marzo-2010
Ubicación: Barcelona
Mensajes: 657
Antigüedad: 14 años
Puntos: 26
Respuesta: 2 errores en mysqli_fetch_array()

mysqli_query ($link,'SET NAMES "utf8" '); No entendí lo que pretendes hacer con esto :S

Última edición por Vallu; 26/10/2010 a las 05:26

Etiquetas: Ninguno
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 19:12.