Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2007
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Parse error: syntax error, unexpected T_STRING

    i looked for this on the forum and did find one but i still dont see whats wrong with my own code, the code that ive written takes the users entered data and adds it to a sql database the data that the user gives is through a form and i have added data that goes along with the users data. well any way heres my code. Im kinda new to php coding but getting there lol

    6. $db = mysql_select_db("MainT");
    7.
    8. $username = $_POST["myusername"];
    9. $password = $_POST["mypassword"];
    10. $email = $_POST["myemail"];
    11. $D1 = $_POST["D1"];
    12.
    13.
    14. $mysql_query INSERT INTO `MainT` VALUES
    (\'\',\'$myusername\',\'$mypassword\',\'$mymail\',\'D1\',\'10000\',\'1\',\'0\',\'0\',\'0\',\'0\',\'0 \',\'0\',\'0\',\'0\',\'20\',\'5000\')';
    15. echo "<font face='Verdana' size='2' color=green>Welcome, You have successfully signed up<br><br><a href=index.htm>Click here to login</a><br></font>";
    16.
    17. echo "Your name and password have been submitted into our database ";
    18.
    19. ?>

    My parse error is on line 14

  • #2
    Regular Coder meth's Avatar
    Join Date
    Jan 2003
    Posts
    262
    Thanks
    0
    Thanked 9 Times in 9 Posts
    PHP Code:
    $mysql_query "INSERT INTO `MainT` VALUES
    (\'\',\'$myusername\',\'$mypassword\',\'$mymail\',\'D1\',\'10000\',\'1\',\'0\',\'0\',\'0\',\'0\',\'0 \',\'0\',\'0\',\'0\',\'20\',\'5000\')"
    ;

    echo 
    "<font face='Verdana' size='2' color=green>Welcome, You have successfully signed up<br><br><a href=index.htm>Click here to login</a><br></font>"
    I do Web Design, Brisbane based.
    More time spent in PHP/MySQL Web Development.
    And Search Engine Optimisation takes up the rest of it.

  • #3
    New Coder
    Join Date
    Aug 2007
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    lol it had to be something silly
    it gives no error now but data doesnt seem to be put into the table, i think i may have something wrong with defining the form fields ?
    :s lol been at this for 3 days now just trying to sort it
    Last edited by 2y2d; 08-09-2007 at 08:38 PM.

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,011
    Thanks
    2
    Thanked 312 Times in 304 Posts
    $mysql_query is a variable. mysql_query() is a function. This link might help with how you execute a query - http://php.net/mysql_query

    Also, quotes that surround a string, defining the beginning and end of the string, are not escaped. Only quotes that are characters within a string are escaped.
    Last edited by CFMaBiSmAd; 08-09-2007 at 08:50 PM.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    New Coder
    Join Date
    Aug 2007
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well thanks thats one problem sorted lol thanks again
    Last edited by 2y2d; 08-09-2007 at 11:30 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •