Unexpected T-VARIABLE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Maximus

    Unexpected T-VARIABLE

    <?
    session_start() ;
    require_once('d b.inc.php');
    $id=$_GET['id'];
    if(!$id) {
    header('Locatio n: main.php');
    } else {

    mysql_select_db ("tbl_posts" )
    $sql=mysql_quer y"SELECT * FROM tbl_posts WHERE post_id ='" .$id. "'";
    $r=mysql_fetch_ array($sql);
    }
    ?>

    can anyone tell me what's wrong with this code?
    it keeps giving me:

    Parse error: syntax error, unexpected T_VARIABLE in C:\Program
    Files\Apache Group\Apache2\h tdocs\secretBox \viewtopic.php on line 10

  • Tim Streater

    #2
    Re: Unexpected T-VARIABLE

    In article <1122567554.573 896.79710@g44g2 000cwa.googlegr oups.com>,
    "Maximus" <teddy.am@gmail .com> wrote:
    [color=blue]
    > <?
    > session_start() ;
    > require_once('d b.inc.php');
    > $id=$_GET['id'];
    > if(!$id) {
    > header('Locatio n: main.php');
    > } else {
    >
    > mysql_select_db ("tbl_posts" )
    > $sql=mysql_quer y"SELECT * FROM tbl_posts WHERE post_id ='" .$id. "'";
    > $r=mysql_fetch_ array($sql);
    > }
    > ?>
    >
    > can anyone tell me what's wrong with this code?
    > it keeps giving me:
    >
    > Parse error: syntax error, unexpected T_VARIABLE in C:\Program
    > Files\Apache Group\Apache2\h tdocs\secretBox \viewtopic.php on line 10[/color]

    Missing ; on your mysql_select_db line.

    -- tim

    Comment

    • black francis

      #3
      Re: Unexpected T-VARIABLE

      /*
      $sql=mysql_quer y"SELECT * FROM tbl_posts WHERE post_id ='" .$id. "'";
      */

      mysql_query("SE LECT ... ")

      Comment

      Working...