giefcat Posted July 14, 2011 Share Posted July 14, 2011 I'm trying to make: Create User. Verify(Make sure its not a copy of the same email, etc..). Save user to database. Allow user to login. Using Heredoc and making it one .php is logic while another .php that's included is display/messages. Just really basic, but for some reason I'm having problems. Index: <html> <head> <body> <a href="create.php">Create Account</a> <br /> <a href="login.php">Log In</a> </head> </body> </html> create.php <?php $here = <<<END <form action="verify.php" method="post"> First Name: <input type="text" name="first" /><br /> Last Name: <input type="text" name="last" /> <br /> Email: <input type="text" name="email" /> <br /> Password: <input type="password" name="pass" /><br /> <input type="submit" value="Submit /> </form> END; echo $here ?> <?php?> verify.php <?php include 'verified.php'; $connection = mysql_connect("localhost", "root", "********"); if (!$connection) { die("Database connection failed: " . mysql_error()); } $db_select = mysql_select_db("test", $connection); if (!$db_select) { die("Database selection failed: " . mysql_error()); } $result = mysql_query("SELECT * FROM users", $connection); if (!$result) { die("Database query failed: " . mysql_error()); } $first = $_POST['first']; $last = $_POST['last']; $email = $_POST['email']; $pass = $_POST['pass']; $query = "INSERT INTO users (id, first, last, email, pass) VALUES (NULL, '{$first}', '{$last}', '{$email}', '{$pass}')"; $create = mysql_query(addslashes($query)) while ($row = mysql_fetch_array($result)) { if($row["email"] == $email) { echo "Email in use."; } else { if($create) { echo "Success!!"; } } } mysql_close($connection); ?> and I'm stuck because it won't insert the data into the database. Can anyone help me? Quote Link to comment https://forums.phpfreaks.com/topic/241952-help-making-createverify-user-log-in-with-heredoc/ Share on other sites More sharing options...
giefcat Posted July 14, 2011 Author Share Posted July 14, 2011 Nevermind, I figured it out. You can delete this topic Quote Link to comment https://forums.phpfreaks.com/topic/241952-help-making-createverify-user-log-in-with-heredoc/#findComment-1242607 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.