Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['create_accnt'])){
- // Verify Information first.
- if(strlen($_POST['fname']) === 0 || strlen($_POST['lname']) === 0 || strlen($_POST['mail']) === 0){
- die('Not all Fields were entered properly. Go <a href="Javascript: history.go(-1)">Back</a> and correct missing fields.');
- }
- // POST Variables are stored in the array $_POST, not _$POST
- // You will also want to look into 'SQL Injection protection' for the future.
- $lname = $_POST['lname'];
- $fname = $_POST['fname'];
- $mail = $_POST['mail'];
- mysql_connect("localhost", "root", "") or die("Unable to connect to MySQL");
- //echo "Connected!!<br>";// You have an error message that tells you if you are not connected, so no need for the connection varification. A lack of error message is confirmation enough.
- mysql_select_db("logindb") or die ("No such Database Found");
- //checking if data is already available or not
- $query = mysql_query("SELECT fname,lname FROM login_details WHERE fname='{$fname}' AND lname='{$lname}' AND mail='{$mail}'"); // You had a typo lame -> lname
- //tells the no of rows for which the data matched
- $rows = mysql_num_rows($query);
- //if data already present
- if($rows > 0){
- echo "data already present fill again";
- }else{//if data is not in database
- echo "value inserted";
- }
- }else{
- echo "not connected!!";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement