468,540 Members | 1,994 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,540 developers. It's quick & easy.

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.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $conn = @mysql_connect("localhost", "root", "password ")
  3.  
  4. $rs1 = @mysql_create_db( $_REQUEST['db'] );
  5.  
  6. $rs2 = @mysql_list_dbs( $conn );
  7. for( $row =0; $row < mysql_num_rows( $rs2 ); $row++ )
  8. { $list .= mysql_tablename( $rs2, $row) ." | "; }
  9. ?>
  10.  
  11. <html>
  12. <head>
  13. <title>Creating databases</title>
  14. </head>
  15. <body>
  16.  
  17. <form action = "<?php echo( $_SERVER['PHP_SELF'] ); ?>"
  18. method="post">Current databases: <?php echo( $list ); ?>
  19. <hr>Name:<input type = "text" name= "db">
  20. <input type = "submit" value = "Create Database">
  21. </form>
  22.  
  23. </body>
  24. </html>
Dec 24 '07 #1
4 4019
pbmods
5,821 Expert 4TB
Heya, NeedHelp. Welcome to TSDN!

You're missing a semicolon on line 2.
Dec 24 '07 #2
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.
Dec 24 '07 #3
pbmods
5,821 Expert 4TB
Heya, NeedHelp.

Check out this article to find out what is going on.
Dec 24 '07 #4
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.
Dec 25 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Ehartwig | last post: by
1 post views Thread by mdouble | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.