I’m having a problem with an SQL Query from php
The Query is
mysql_query("INSERT INTO `pwn_users` (`name`,`email`,`password`) values ('$chosen_name','$chosen_mail','$chosen_pw')"))
When I print the Query text like this:
print "INSERT INTO `pwn_users` (`name`,`email`,`password`) values ('$chosen_name','$chosen_mail','$chosen_pw')";
it will return my inputs like this:
INSERT INTO `pwn_users` (`name`,`email`,`password`) values ('Testuser','testmail@test.us','testpass')
The data though is not inserted into the table. But when I copy that last statement directly into phpmyAdmin’s SQL Querybox it will insert correctly.
I don’t know if it’s a typo or not, but your first line of code has one abundant
)at the end and it’s missing a semi-colon.If you use
mysql_query()with only one parameter it uses “the last link opened by mysql_connect()”. Are you sure you have an open connection?If you are sure you have an open connection you can always try calling
mysql_error()after callingmysql_query()to get more information about possible errors.EDIT; in response to the other answers; there is nothing wrong with your quotes, apostrophes or reversed apostrophes.