Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/10/2010, 04:11
albertrc
 
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