Page 1 of 1

Issue with php and sql

Posted: Sun Nov 15, 2009 3:07 pm
by nick2price
Hi, So i am creating a register form which has the fields login, pass and email. In my php, I connect to my database and extract the data and perform my query to insert the data into my database. I think this is the important part

Code: Select all

$_POST['login']=mysql_real_escape_string(strip_tags(trim($_POST['login'])));
$_POST['pass']=mysql_real_escape_string(strip_tags(trim($_POST['pass'])));
$_POST['email']=mysql_real_escape_string(strip_tags(trim($_POST['email'])));
 
mysql_query("INSERT INTO login SET login='{$_POST['login']}',pass='{$_POST['pass'],email='{$_POST['email']}'",$db);
When I test it out, I am getting the error on my webpage
Parse error: syntax error, unexpected ',', expecting '}' in C:\xampplite\htdocs\register.php on line 22
I know this is a simple error, but I am clueless and have no idea where or what to put in my statement. I added the email part of the statement myself, but all I thought I did was copy the pass one and then change the variables, so I dont know how I have muddled up the " etc.

Any help would be appreciated

cheers

Re: Issue with php and sql

Posted: Sun Nov 15, 2009 4:23 pm
by nick2price
No worries, sorted this issue out.

Posted: Thu Nov 19, 2009 10:45 am
by Jonah Bron
Glad you got it working. Please remember to post code questions in the PHP - Code section.