Parse error: syntax error, unexpected T_VARIABLE on line 4

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • needhelp08
    New Member
    • Dec 2007
    • 2

    Parse error: syntax error, unexpected T_VARIABLE on line 4

    I am getting the error Parse error: syntax error, unexpected T_VARIABLE on line 4 but I can't seem to find what is wrong. Could someone please help.
    [code=php]
    <?php
    $conn = @mysql_connect( "localhost" , "root", "password ")

    $rs1 = @mysql_create_d b( $_REQUEST['db'] );

    $rs2 = @mysql_list_dbs ( $conn );
    for( $row =0; $row < mysql_num_rows( $rs2 ); $row++ )
    { $list .= mysql_tablename ( $rs2, $row) ." | "; }
    ?>

    <html>
    <head>
    <title>Creati ng databases</title>
    </head>
    <body>

    <form action = "<?php echo( $_SERVER['PHP_SELF'] ); ?>"
    method="post">C urrent databases: <?php echo( $list ); ?>
    <hr>Name:<inp ut type = "text" name= "db">
    <input type = "submit" value = "Create Database">
    </form>

    </body>
    </html>[/code]
    Last edited by pbmods; Dec 24 '07, 05:50 AM. Reason: Added CODE tags.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, NeedHelp. Welcome to TSDN!

    You're missing a semicolon on line 2.

    Comment

    • needhelp08
      New Member
      • Dec 2007
      • 2

      #3
      Originally posted by pbmods
      Heya, NeedHelp. Welcome to TSDN!

      You're missing a semicolon on line 2.
      I tried putting that in then the screen just comes up blank. No errors, but nothing else either.

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, NeedHelp.

        Check out this article to find out what is going on.

        Comment

        • gasfusion
          New Member
          • Sep 2006
          • 59

          #5
          get rid of the @ in front of mysql commands. That suppresses any error messages you may have from sql. Then rerun the script and see what you get.
          In addition to that, you php script should probably execute when you get submit and not on reload.

          Comment

          Working...