By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,358 Members | 2,811 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,358 IT Pros & Developers. It's quick & easy.

Parse error: syntax error, unexpected T_VARIABLE on line 4

P: 2
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
Share this Question
Share on Google+
4 Replies


pbmods
Expert 5K+
P: 5,821
Heya, NeedHelp. Welcome to TSDN!

You're missing a semicolon on line 2.
Dec 24 '07 #2

P: 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
Expert 5K+
P: 5,821
Heya, NeedHelp.

Check out this article to find out what is going on.
Dec 24 '07 #4

P: 59
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.