Foros del Web » Programando para Internet » PHP »

¿Donde estan los fallos?

Estas en el tema de ¿Donde estan los fallos? en el foro de PHP en Foros del Web. Buenas, no se donde he cometido el/los errores en este código. Me dice. Cita: Parse error: syntax error, unexpected $end in /homepages/30/d230233337/htdocs/prueba.php on line 56 ...
  #1 (permalink)  
Antiguo 09/03/2008, 17:29
Avatar de Shadres  
Fecha de Ingreso: noviembre-2007
Ubicación: Murcia.
Mensajes: 13
Antigüedad: 16 años, 5 meses
Puntos: 0
¿Donde estan los fallos?

Buenas, no se donde he cometido el/los errores en este código.

Me dice.
Cita:
Parse error: syntax error, unexpected $end in /homepages/30/d230233337/htdocs/prueba.php on line 56
Los censured de la conexion sql los he puesto yo para el post.


Código:
<body>
<?
if(isset($form)):?>
<form action="<?php echo($PHP_SELF); ?>" method="post">
<p>
Nombre<br/>
		<input type="text" name="nombre" value="" />
<br/>
Dinero<br/>
		<input type="text" name="dinero" value="0"/>
<br/>
		<input type="submit" name="send" value="send" />
</p>
</form>
<?
else:
$conexion= mysql_connect("censured","censured","censured");
if (!$conexion) {
  echo( "<P>Unable to connect to the database server at this time.</P>" );
  exit();
}
if (! @mysql_select_db("usuario") ) {
  echo( "<P>Unable to locate the joke database at this time.</P>" );
  exit();
  
  if ("send" == $send) {
  $sql = "INSERT INTO usuario SET nombre='$nombre', dinero='$dinero'";
if (mysql_query($sql)) {
  echo("<P>Your joke has been added.</P>");
} else {
  echo("<P>Error adding submitted joke:".mysql_error() . "</P>");
}
}
echo("<P> Here are all the jokes in our database: </P>");
$result = mysql_query("SELECT nombre , dinero FROM usuario");
if (!$result) {
  echo("<P>Error performing query:".mysql_error() . "</P>");
  exit();
}
while ( $row = mysql_fetch_array($result) ) {
  echo("<P>" . $row["usuario"] . "</P>");
  echo("<P>" . $row["dinero"] . "</P>");
}
echo("<P><A HREF='$PHP_SELF?addjoke=1'>Add a Joke!</A></P>");
?>

</body>
</html>
  #2 (permalink)  
Antiguo 09/03/2008, 17:40
 
Fecha de Ingreso: marzo-2008
Mensajes: 19
Antigüedad: 16 años, 1 mes
Puntos: 1
Re: ¿Donde estan los fallos?

A lo mejor no es esto pero no veo donde esta la llave de cierre de
Código:
if (! @mysql_select_db("usuario") ) {
  #3 (permalink)  
Antiguo 09/03/2008, 17:41
 
Fecha de Ingreso: enero-2008
Mensajes: 132
Antigüedad: 16 años, 2 meses
Puntos: 6
Re: ¿Donde estan los fallos?

falta una llave antes de ?>

}
?>

</body>
</html>
  #4 (permalink)  
Antiguo 09/03/2008, 18:13
Avatar de Shadres  
Fecha de Ingreso: noviembre-2007
Ubicación: Murcia.
Mensajes: 13
Antigüedad: 16 años, 5 meses
Puntos: 0
Re: ¿Donde estan los fallos?

Solucionado.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:05.