![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
15/04/2008, 11:26
|
![Avatar de ferbux](http://static.forosdelweb.com/customavatars/avatar180221_1.gif) | | | Fecha de Ingreso: mayo-2007 Ubicación: por ahí intentado ayudar
Mensajes: 823
Antigüedad: 17 años, 9 meses Puntos: 6 | |
Re: PROBLEMA CON mysql_num_rows Prueba hacerlo asi:
Código:
<?php
include ("conection.php");
$conectar=Conectar();
$nombre=$_POST['nombre'];
if(strlen($nombre)>0)
{
$consulta="SELECT nombre FROM azona WHERE nombre='$nombre'";
$resultado=mysql_query($consulta, $conectar);
$fila=mysql_num_rows($resultado);
if($fila<1)
{
$q="INSERT INTO azona VALUES ('$nombre')";
$nuevo=mysql_query($q,$conectar);
echo "<script languaje=javascript>".
"alert(\"La nueva área se registro exitosamente.\");".
"location.href=\"altas01.php\";".
"</script>";
}
else
{
echo "<script languaje=javascript>".
"alert(\"Ese nombre de área ya se ha registrado.\");".
"location.href=\"altas01.php\";".
"</script>";
}
}
else
{
echo "<script languaje=javascript>".
"alert(\"Llene todos los campos.\");".
"location.href=\"altas01.php\";".
"</script>";
}
?>
__________________ "Eres grande por que caminas entre gigantes" |