Ver Mensaje Individual
  #3 (permalink)  
Antiguo 31/01/2005, 11:39
ThunderFx
 
Fecha de Ingreso: diciembre-2003
Ubicación: Campehce, Mexico
Mensajes: 325
Antigüedad: 20 años, 4 meses
Puntos: 0
Este es mi codigo:

<?

include("conexion.php");

$sql = "SELECT * FROM alumnos WHERE matricula=matricula";
$result = mysql_query($sql);

if (mysql_num_rows($result) !=0)
{
echo "<p align='center'><font face='Tahoma'><span style='font-size: 8pt'>La matricula
<b>$matricula</b> ya existe.</span></font></p>
<p align='center'><font face='Tahoma' style='font-size: 8pt'>
<a href='?ID=altas'>Ingresar de Nuevo</a></font></p>";
}
else
{
$consulta = "INSERT INTO alumnos (id,matricula,nombre,apellidos) VALUES ('','$matricula','nombre','$apellidos')";
mysql_query($consulta);

echo "<p align='center' style='margin-top: 0; margin-bottom: 0'>
<font face='Tahoma' style='font-size: 8pt'>Agregado a la base de datos el alumno
<b>$nombre $apellidos</b> con matricula <b>$matricula</b>.</font></p>
<p align='center' style='margin-top: 0; margin-bottom: 0'>&nbsp;</p>
<p align='center' style='margin-top: 0; margin-bottom: 0'>
<font face='Tahoma' style='font-size: 8pt'><a href='index.php'>Regresar al Index</a></font></p>";
}

?>

y cualquier alta que doy me dice que ya existe :(