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>