Help making Create/Verify User & Log-In with Heredoc

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:

[code]

Create Account
Log In [/code]

create.php

[code]<?php
$here = <<<END

First Name:
Last Name:
Email:
Password:
<input type="submit" value="Submit /> </form> <p>END;<br> echo $here<br> ?></p> <?php?>[/code] <p>verify.php</p> <p>[code]<?php<br> include ‘verified.php’;<br> $connection = mysql_connect(“localhost”, “root”, “********”);<br> if (!$connection) {<br> die("Database connection failed: " . mysql_error());<br> }</p> <p>$db_select = mysql_select_db(“test”, $connection);<br> if (!$db_select) {<br> die("Database selection failed: " . mysql_error());<br> }<br> $result = mysql_query(“SELECT * FROM users”, $connection);<br> if (!$result) {<br> die("Database query failed: " . mysql_error());<br> }<br> $first = $_POST[‘first’];<br> $last = $_POST[‘last’];<br> $email = $_POST[‘email’];<br> $pass = $_POST[‘pass’];<br> $query = “INSERT INTO users (id, first, last, email, pass)<br> VALUES (NULL, ‘{$first}’, ‘{$last}’, ‘{$email}’, ‘{$pass}’)”;<br> $create = mysql_query(addslashes($query))</p> <pre><code> while ($row = mysql_fetch_array($result)) { if($row["email"] == $email) { echo "Email in use."; } else { if($create) { echo "Success!!"; } } } </code></pre> <p>mysql_close($connection);<br> ?>[/code]</p> <p>and I’m stuck because it won’t insert the data into the database. Can anyone help me?</p>

[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 email FROM users", $connection); if (!$result) { die("Database query failed: " . mysql_error()); } $first = strip_tags($_POST['first']); $first=mysql_real_escape_string($first); $last = strip_tags($_POST['last']); $last=mysql_real_escape_string($last); $email = strip_tags($_POST['email']); $email=mysql_real_escape_string($email); $pass =mysql_real_escape_string($_POST['pass']); while($row = mysql_fetch_assoc($result)){ if($row["email"] == $email) { echo "Email in use."; } } mysql_query("INSERT INTO `users` (`id`, `first`, `last`, `email`, `pass`) VALUES (NULL, '$first', '$last', '$email', '$pass')"); echo "Success!!"; mysql_close($connection); ?>[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service