...

View Full Version : Parse error: syntax error, unexpected T_STRING



2y2d
08-09-2007, 08:08 PM
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

meth
08-09-2007, 08:25 PM
$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>";

2y2d
08-09-2007, 08:34 PM
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

CFMaBiSmAd
08-09-2007, 08:48 PM
$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.

2y2d
08-09-2007, 08:57 PM
well thanks :) thats one problem sorted lol :) thanks again



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum