开发者

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

开发者 https://www.devze.com 2023-02-05 16:04 出处:网络
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)

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

精彩评论

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