counting rows with mysql and php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • whitep8
    New Member
    • Oct 2009
    • 65

    counting rows with mysql and php

    Hi all,

    Im at a loss here. There are definitly a lot of emails repeated in the table, but it just wont echo out anything.

    all help is appreciated

    Code:
    <?php
    session_start();
    include "connect.php";
    		$name = $_SESSION['name'];
    		$email = $_SESSION['email'];
    		$nationality = $_SESSION['country'];
    $query = "SELECT * FROM tbl_beta WHERE email =' $email'" or die(mysql_error());
    $result = mysql_query($query);
    $unique = mysql_num_rows($result);
    if($unique > 1){
    	echo "Sorry, That email has already been registered in out database.  Please contact support at ";
    	exit();
    	}else{
    	$SQL = "INSERT INTO tbl_beta (name, email, nationality) VALUES ('$name', '$email', '$nationality')";
    		$result = mysql_db_query($db,$SQL,$cid);
        echo "Thanks for registering " . $name;
        echo "<br>We will be in touch shortly."; 
    	$_SESSION['betaemail'] = $email;
    	include "mail.php";
    	}
    	?>
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    I imagine that space before $email is causing your problem (line 7).

    Comment

    Working...