Here is the code: $values = 'VALUES ("'.$user_name.'", "'.$user_name.'", "'.$user_name.'", "'.$user_pass.'", "'.$user_email.'", "'.user_ip.'")'; $insert = mysql_query("INSERT INTO member(user_name, bidder_name, seller_name, user_pass, user_email, user_ip) " .$values); if($insert) { ///Yippie it's done, now ask that guy to login header('location: login.php'); } } mysql_close($conn); ?> PHP: In the member database, the columns are user_name, bidder_name, seller_name, user_pass, user_ip, user_email in that order. The registration form just asks for username, password and e-mail address. I am using PHP version 5.3.10 MySQL version 5.0.95-community What could be wrong? How come when someone submits the form and it says it's successful, but there are no entries in the database?
Try if(mysql_query("INSERT INTO member VALUES('$user_name', NULL, NULL, '$user_pass', NULL, '$user_email');")) { ///Yippie it's done, now ask that guy to login header('location: login.php'); } PHP: Make sure you've protected those variables against SQL injection attacks before you use them.
At the time the query executes, what are the values of $user_name, $user_pass and $user_email? If they're empty or null, you'll get an empty row.
Nah, I wrote something in each field. I'm wondering.. could this have something to do with me upgrading my mysql version?
You're beating a dead horse here. Noone here cares about SQL Injection or have the slightest idea what it is or how to avoid it. Even if you tell them...it goes on one ear and out the other.
And you know this how? Because you're certain that you filled the variables? Or because your debugger showed you that they had non-null values in them when the INSERT statement executed. I know I've only been writing software for 40 years, so I don't assume that I don't make mistakes yet, but is it at all possible that your code has a bug? Only if you upgraded to a version that doesn't do inserts. If your variables have non-null values, any SQL-based database should insert those values into a new row with your original INSERT statement, unless I'm missing some subtle typo. @NetStar: I know. Gotta leave some honeypots on the web though, don't we?
try this: $result = mysql_query("INSERT INTO `member`(`user_name`, `bidder_name`, `seller_name`, `user_pass`, `user_email`, `user_ip`) VALUES ('$user_name', '$user_name', '$user_name', '$user_pass', '$user_email', 'user_ip')"); if($result) { ///Yippie it's done, now ask that guy to login header('location: login.php'); } PHP: I hope it will help you