Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

shreydesai

macrumors member
Original poster
Mar 15, 2012
76
1
California
With Dreamweaver and PHP, I am trying to use an HTML form that I created to add tables to my MySQL database, but it's just not adding! The MySQL Database is called 'login' and the table is called 'users', and here is the code I put into Dreamweaver:

$query = mysql_query("INSERT INTO users VALUES ('','$name','$username','$enc_password')")

Any suggestions?
 
Use this syntax, it's clearer:

INSERT into USERS ('ID','name','username','password') VALUES (NULL,'$name','$username','$enc_password')

I do hope that you are escaping each string using mysql->real_escape_string.

I also suggest you use mysqli over mysql.

maybe you can tell us more if there are any error using:

$query = mysql_query("INSERT into USERS ('ID','name','username','password') VALUES (NULL,'$name','$username','$enc_password')") or die(mysql_error());

I have assumed that the first field is an ID field.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.