Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/07/2012, 18:06
MAyte_
 
Fecha de Ingreso: julio-2012
Mensajes: 1
Antigüedad: 11 años, 9 meses
Puntos: 0
Pregunta Parse error: syntax error, unexpected T_ELSE in

Bueno , antes que nada espero me puedan ayudar con este problema , no soy muy buena en programacion y la verdad no entiendo porque pasa esto :S

Parse error: syntax error, unexpected T_ELSE in C:\xampp\htdocs\xampp\agregar.php on line 37

Este es el error que me indica y ya revise y segun yo no hace falta ninguna llave, la verdad apreciaria que me ayudaran y corrigieran los errores de este codigo porque no estoy segura de si esta bien , el codigo es el siguiente:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content= "text/html; charset=iso-8859-1"/>
<title>Agregar Datos </title>
</head>
<body>
<form action="agregar.php" method="post" name="agre">
Codigo: <input type="text" name="codigo" value="<?php echo !empty($_POST['codigo']) ? $_POST['codigo'] : ''; ?>"/>
<br/>
Nombre: <input type="text" name="nombre" value="<?php echo !empty($_POST['nombre']) ? $_POST['nombre'] : ''; ?>"/>
<br/>
Edad: <input type="text" name="edad" value="<?php echo !empty($_POST['edad']) ? $_POST['edad'] : ''; ?>"/>
<br/>
puesto: <input type="text" name="puesto" value="<?php echo !empty($_POST['puesto']) ? $_POST['puesto'] : ''; ?>"/>
<br/>
<input type="submit" name="agregar" value="Agregar Datos " />
<a href="proyecto.php">Regresar a Menu</a>
</form>
</body>
<?php
if (isset($_POST['agregar']))
{
if ($_POST['nombre'] != "" and $_POST['codigo'] != "" and $_POST['edad'] != "" and $_POST['puesto'] != "")
{
$dp1=mysql_connect('localhost','root','');
mysql_select_db('base',$dp1);
$sql1="SELECT * FROM proyecto WHERE id = ".$_POST['codigo'];
$res=mysql_query($sql1);
if($row=mysql_fetch_assoc($res)== true);
{
echo "<script type='text/javascript'>
alert('La ID que ingreso ya existe');
</script>";
}
else
{
$dp1=mysql_connect('localhost','root','');
mysql_select_db('base',$dp1);
$sql="INSERT INTO proyecto (codigo,Nombre,edad,puesto) VALUES ('".$_POST['codigo']."','".$_POST['nombre']."', '".$_POST['edad']."', '".$_POST['puesto']."')";
$resultado=mysql_query($sql);
echo "<script type='text/javascript'>
alert('Datos insertados');
document.agregar.codigo.value='';
document.agregar.nombre.value='';
document.agregar.edad.value='';
document.agregar.puesto.value='';
</script>";
}
mysql_close($dp1);
}
else
{
echo "<script type='text/javascript'>
alert('Favor de llenar todos los campos');
</script>";
}
}
}
?>

Porfavor espero que me puedan ayudar :S