Ver Mensaje Individual
  #4 (permalink)  
Antiguo 22/07/2012, 07:04
Avatar de dryant
dryant
 
Fecha de Ingreso: agosto-2009
Ubicación: Malaga, Ceuta, España....
Mensajes: 283
Antigüedad: 14 años, 8 meses
Puntos: 10
Respuesta: Insertar datos si no existen

Hola
He intentado lo que me has dicho de la siguiente forma :
Código PHP:
 echo "Ingredientes necesarios:".
        
"<ol>";
   while (
$i $n)
   {
    if (
$ingrediente[$i]!='')
        {
         echo 
"<li>{$ingrediente[$i]} {$cantidad[$i]} {$idUnidad[$i]}</li>";
         
mysql_query("SELECT * FROM ingredientes");
         if (
exist($ingrediente[$i])) {
            echo 
"el ingrediente"$ingrediente[$i]." ya existe por lo que no se ha introducido<br> ";
            }else{
         
mysql_query("INSERT INTO ingredientes (nombreIngrediente) VALUES ('".$ingrediente[$i]."')");}
        }
      
$i++;
   }
   
   echo 
"</ol>"
Pero me devuelve el siguiente error:
Cita:
Fatal error: Call to undefined function exist() in /Applications/XAMPP/xamppfiles/htdocs/recetas/insertarreceta.php on line 98
Porque?
__________________
Tecnología y tutoriales