Foros del Web » Programando para Internet » PHP »

¿Por qué no me quiere terminar?

Estas en el tema de ¿Por qué no me quiere terminar? en el foro de PHP en Foros del Web. Lo leí muchas veces y aún no entiendo porque: Cita: Parse error: syntax error, unexpected $end in /home/vhosts/expressohogwarts.6te.net/diagon/tiendas/ollivanders2.php on line 152 Página: @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código ...
  #1 (permalink)  
Antiguo 17/07/2009, 01:06
 
Fecha de Ingreso: julio-2006
Mensajes: 254
Antigüedad: 17 años, 9 meses
Puntos: 0
¿Por qué no me quiere terminar?

Lo leí muchas veces y aún no entiendo porque:
Cita:
Parse error: syntax error, unexpected $end in /home/vhosts/expressohogwarts.6te.net/diagon/tiendas/ollivanders2.php on line 152

Página:

Código php:
Ver original
  1. <?php
  2. # FileName="Connection_php_mysql.htm"
  3. # Type="MYSQL"
  4. # HTTP="true"
  5. $hostname_general = "*************";
  6. $database_general = "*************";
  7. $username_general = "*************";
  8. $password_general = "*************";
  9. $general = mysql_pconnect($hostname_general, $username_general, $password_general) or trigger_error(mysql_error(),E_USER_ERROR);
  10. ?>
  11. <?php
  12. if (!function_exists("GetSQLValueString")) {
  13. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  14. {
  15.   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  16.  
  17.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  18.  
  19.   switch ($theType) {
  20.     case "text":
  21.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  22.       break;    
  23.     case "long":
  24.     case "int":
  25.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  26.       break;
  27.     case "double":
  28.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  29.       break;
  30.     case "date":
  31.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  32.       break;
  33.     case "defined":
  34.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  35.       break;
  36.   }
  37.   return $theValue;
  38. }
  39. }
  40.  
  41. $colname_obj = "-1";
  42. if (isset($_POST['radio'])) {
  43.   $colname_obj = $_POST['radio'];
  44. }
  45. mysql_select_db($database_general, $general);
  46. $query_obj = sprintf("SELECT * FROM objetos WHERE id = %s", GetSQLValueString($colname_obj, "int"));
  47. $obj = mysql_query($query_obj, $general) or die(mysql_error());
  48. $row_obj = mysql_fetch_assoc($obj);
  49. $totalRows_obj = mysql_num_rows($obj);
  50.  
  51. $colname_banco = "-1";
  52. if (isset($_SESSION['MM_Username'])) {
  53.   $colname_banco = $_SESSION['MM_Username'];
  54. }
  55. mysql_select_db($database_general, $general);
  56. $query_banco = sprintf("SELECT * FROM banco WHERE usuario = %s", GetSQLValueString($colname_banco, "text"));
  57. $banco = mysql_query($query_banco, $general) or die(mysql_error());
  58. $row_banco = mysql_fetch_assoc($banco);
  59. $totalRows_banco = mysql_num_rows($banco);
  60.  
  61. $colname_user = "-1";
  62. if (isset($_SESSION['MM_Username'])) {
  63.   $colname_user = $_SESSION['MM_Username'];
  64. }
  65. mysql_select_db($database_general, $general);
  66. $query_user = sprintf("SELECT * FROM usuarios WHERE usuario = %s", GetSQLValueString($colname_user, "text"));
  67. $user = mysql_query($query_user, $general) or die(mysql_error());
  68. $row_user = mysql_fetch_assoc($user);
  69. $totalRows_user = mysql_num_rows($user);
  70. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  71. <html xmlns="http://www.w3.org/1999/xhtml">
  72. <head>
  73. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  74. <title>Untitled Document</title>
  75. <style type="text/css">
  76. <!--
  77. body {
  78.     background-color: #02021E;
  79. }
  80. .style2 {
  81.     font-family: Geneva, Arial, Helvetica, sans-serif;
  82.     color: #FFFFFF;
  83. }
  84. -->
  85. </style></head>
  86.  
  87. <body>
  88. <div align="center" class="style2">
  89.   <p>Boleto de compra (Parte 2)</p>
  90.   <p><strong>POR FAVOR, LEA.</strong></p>
  91.   <p>Usted decidío agregar a su inventario y gastar:</p>
  92.   <p>
  93.     <label><?php echo $row_obj['nombre']; ?></label>
  94. </p>
  95.   <p>Inventario:</p>
  96.   <?
  97.  
  98. $hacer=mysql_query("INSERT INTO inventario (id_usuario,id_objeto)
  99. VALUES ('$row_user[id]','$_POST[radio]')",$general);
  100.   $my_error = mysql_error($general);
  101.       if(!empty($my_error)) {
  102.  
  103.         echo "Ocurrio un error. $my_error";
  104.  
  105.     } else {
  106.  
  107.         echo "Exito al ingresar el objeto en su inventario";
  108.  
  109.     }
  110.  
  111.  
  112.    ?>
  113.   <p>Gringotts:</p>
  114.   <p><?
  115.   if(($row_banco['oro'] > $row_obj['valor_oro']) &&  ($row_banco['plata'] > $row_obj['valor_plata']))
  116.   {
  117.   $oronuevo = $row_banco['oro'] -  $row_obj['valor_oro'];
  118.   $platanueva = $row_banco['plata'] - $row_obj['valor_plata'] ;
  119.   $accion=mysql_query("UPDATE banco SET oro=$oronuevo,
  120.    plata=$platanueva WHERE usuario = $row_user[usuario]",$general);
  121.     $my_error = mysql_error($general);
  122.       if(!empty($my_error)) {
  123.  
  124.         echo "Ocurrio un error. $my_error";
  125.  
  126.     } else {
  127.  
  128.         echo "Dinero actualizado";
  129.  
  130.     }
  131.  
  132.  
  133.  
  134.  
  135.  
  136.    ?>&nbsp;</p>
  137.   <p>Usted puede seguir comprando.</p>
  138. </div>
  139. </body>
  140. <?php
  141.  
  142.  
  143. ?>
  144.  
  145. </html>

Edito: Me faltaba un cierre :D

Última edición por lauchalp95; 17/07/2009 a las 01:15
  #2 (permalink)  
Antiguo 17/07/2009, 03:09
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: ¿Por qué no me quiere terminar?

#
if(($row_banco['oro'] > $row_obj['valor_oro']) && ($row_banco['plata'] > $row_obj['valor_plata']))
#
{

donde cierra??? ese if
__________________
Gokuh Salvo al mundo. PUNTO!!!!
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 22:48.