开发者

MySQL Query: How can I add a user to my MySQL database with PHP

How can I add a user to my MySQL database with PHP. This doe开发者_StackOverflowsn't add a user.

mysql_query("INSERT INTO users (name, password, realname) 
            VALUES ('$myusername', '$mypassword', '$myrealname'"); 

What seems to be the problem with my query?


You forgot the closing bracket for VALUES

mysql_query("INSERT INTO users (name, password, realname) 
            VALUES ('$myusername', '$mypassword', '$myrealname')");


By the way, this code looks dangerous. You escaped everything before to prevent SQL injection, or you are in a very save environment?


Your double quotes should be after the closing bracket.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜