PDA

View Full Version : PHP Code Problem....



stamatiou
February 27th, 2011, 12:05 PM
Plz Help,
is ther anything wrong with this code?

mysql_query("INSERT INTO usersystem (school,name,ln,ec,gc,username, password, email) VALUES ( '$school',$name','$ln','$ec','$class','$username', '$password', '$email')") or die (mysql_error()); echo "Account created.";)

khauenst
February 27th, 2011, 02:04 PM
I know nothing about PHP but it seems the left hand quote around $name is missing

Joeb454
February 27th, 2011, 02:17 PM
As well as the above, you appear to have an erroneous ')' at the end of the line

Skidbladnir
February 27th, 2011, 07:47 PM
Plz Help,
is ther anything wrong with this code?

mysql_query("INSERT INTO usersystem (school,name,ln,ec,gc,username, password, email) VALUES ( '$school',$name','$ln','$ec','$class','$username', '$password', '$email')") or die (mysql_error()); echo "Account created.";)


Well, there are two things. Firstly, you should run mysql_real_escape_string on those fields, because they are likely coming from a third party. Anyway, you do not have a single ' around $name. Also, the ending parenthesis closes the VALUES function.