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 AccountLog In [/code]
create.php
[code]<?php
$here = <<<END
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>