Re: Parse error: syntax error, unexpected T_ELSE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 15, 2008 at 4:49 PM, Javier Viegas <javiercviegas@xxxxxxxxx> wrote:
> Hi, i have this script wich basically connects to a database and delete a
>  record according to the Id parameter given. The problem is that when i test
>  it i get this error:
>
>  *Parse error*: syntax error, unexpected T_ELSE in *
>  /var/www/biblio/scripts/delete.php* on line *31

    Javier,

    This block:

} else {
     $r_string = '&errorcode=4&';

}

    .... is incorrect.  You call an else condition on line 21, so PHP
expects that block to be the last for that if() condition.  Either
remove the } else { and $r_string = '&errorcode=4&'; lines or rewrite
the condition.

    And if that's your real database login information, change it and
update all of your scripts and systems ASAP.


>
>  This is the script:
>
>  *<?php
>  /*
>    deletescore.php:  deletes record for passed id from highscores table and
>                      returns status to Flash
>  */
>  // fill with correct data for your server configuration
>  $server = "localhost";
>  $username = "root";
>  $password = "itsveryeasy";
>  $database = "biblioteca";
>
>  //connect to database added by calm
>  mysql_connect($server, $username, $password);
>
>  if (!mysql_connect($server, $username, $password)) {
>    $r_string = '&errorcode=1&';
>
>  } elseif (!mysql_select_db($database)) {
>    $r_string = '&errorcode=2&';
>
>  } else {
>
>       $del_str = "DELETE FROM libros WHERE bnumero=".$_GET['Id'];
>
>       if (!mysql_query ($del_str)) {
>          $msg = mysql_error();
>          $r_string = '&errorcode=3&msg='.$msg;
>       } else {
>          $r_string = '&errorcode=0&';
>       }
>    } else {
>       $r_string = '&errorcode=4&';
>
>  }
>
>  echo $r_string;
>  ?>
>
>  Wha am i doing wrong??
>
>  Thanks.
>
>  Javier
>



-- 
</Daniel P. Brown>
Ask me about:
Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
and shared hosting starting @ $2.50/mo.
Unmanaged, managed, and fully-managed!

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux