redarrow Posted February 6, 2007 Share Posted February 6, 2007 I have the varable posting from a page and the database is getting all the information from the email varable but the condition not working with the varable email now the varable email is there but the condition not working if i use name or password all works but not with email any idears please. yes i have also tried the $_POST statement but no luck. <?php session_start(); $db=mysql_connect("localhost","xxx","xxx"); mysql_select_db("mat_website"); $query="select email from blog_register where email='$email'"; $result=mysql_query($query); if(mysql_num_rows($result)>1){ include("header.php"); echo "<html><body bgcolor='#ff333' vlink='blue' link='blue' alink='blue'><br><br><br><br><table align='center'><tr><td> Sorry but username is taken <a href='register.php'>please try again</a><br><br>Thank you.</tr></td></table></body></html>"; exit; } ?> Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted February 6, 2007 Share Posted February 6, 2007 i dunno about your condition, but at first glance it looks like you're missin a hex in your hexidecimal bgcolor attribute. also, the problem may be your query. try replacing your variable $email with a value you KNOW is in the blog_register table. if your condition isn't working, it's probably because your query isn't valid. <?php session_start(); $db = mysql_connect("localhost","xxx","xxx"); mysql_select_db("mat_website"); $query = "select email from blog_register where email='$email'"; $result = mysql_query($query) OR die(mysql_error()); $numRows = mysql_num_rows($result); echo "Number of results: ". $numRows ."<br />\n"; if($numRows > 1){ include("header.php"); echo "<html><body bgcolor='#ff333' vlink='blue' link='blue' alink='blue'><br><br><br><br><table align='center'><tr><td> Sorry but username is taken <a href='register.php'>please try again</a><br><br>Thank you.</tr></td></table></body></html>"; exit; } ?> that may help further diagnose the issue. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 6, 2007 Share Posted February 6, 2007 before we continue, are you having a bad spelling day or is english not your 1st language. it's variable not varable. well, are you positive that the email you are checking for is in the database. is everything there? Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 6, 2007 Author Share Posted February 6, 2007 boo i got 9 result using name in the select statement but 0 with email and yes there are nine the same as name weired. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 6, 2007 Share Posted February 6, 2007 so the email you are entering is corresponding with the email in the database? and where is the $email variable set? Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted February 6, 2007 Share Posted February 6, 2007 project is right. it's not your query, it's your $email variable. maybe you should print the variable before it goes into the query, then cross-reference it with your database. Quote Link to comment 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.