alivec Posted March 26, 2008 Share Posted March 26, 2008 i get this error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(email, username, password) VALUES('test@test.com', 'test', '77004' at line 1 this is reg.php <?php $host = "localhost"; $username = "root"; $password = ""; $db_name ="alivecsetup"; $tbl_name ="members"; @mysql_connect($host, $username, $password) or die ("Can't Connect"); @mysql_select_db($db_name) or die(mysql_error()); $username = $_POST['username']; $password = $_POST['password']; $email = $_POST['email']; $username = stripslashes($username); $email = stripslashes($email); if((!$username) || (!$password) || (!$email)){ echo '<h3>All fields are required!</h3>'; include 'register.html'; exit(); } $db_password = md5($password); $sql = mysql_query("INSERT INTO $table_name (email, username, password) VALUES('$email', '$username', '$db_password', now())") or die (mysql_error()); if(!$sql) echo "There was an error while creating you account. Please contact an admin."; else { $userid = mysql_insert_id(); //mailing time $subject = "Membership at my-website.com"; $message = "Dear $username, Thank you for registering at our website, Here is your login information: Username: $username Password: $password Thanks! The Webmaster This is an automated response, please do not reply!"; mail($email, $subject, $message, "From: E-Nuke Webmaster<admin@e-nuke.net>\n X-Mailer: PHP/" . phpversion()); echo "<meta http-equiv=\"Refresh\" content=\"0; URL=http://friiks.awardspace.com/register.htm\"/>You will be redirected to login page."; } ?> i don't know if you need this but.. <html> <head> <title>Register</title> </head> <body> <form action='reg.php' method="post" name="loginform" id="loginform"> <table> <tr> <td>Username:</td><td><input type="username" name="username" class='text'></td> </tr> <tr> <td>Password:</td><td><input type="password" name="password" class='text'> </td> </tr> <tr> <td>E-mail:</td><td><input type="email" name="email" class='text'> </td> </tr> <tr><td><input type="submit" name="Submit" class='button' value="Register"></td> </tr> </table> </form> </body> </html> now i know echo "There was an error while creating you account. Please contact an admin."; i should add { and } but when i do i get this errorParse error: syntax error, unexpected '{' in C:\xampp\htdocs\login\reg.php on line 35 thank you for helping i hope you can figure this out i cant. Quote Link to comment Share on other sites More sharing options...
Coreye Posted March 26, 2008 Share Posted March 26, 2008 Which third party PHP script are you using? If your not using a third party PHP script, post on this forum: http://www.phpfreaks.com/forums/index.php/board,1.0.html. Quote Link to comment Share on other sites More sharing options...
rw57 Posted March 26, 2008 Share Posted March 26, 2008 You are trying to insert 4 values but you only have 3 column names. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.