Gath Posted January 30, 2013 Share Posted January 30, 2013 So, alghouth i know there are results in the db, i keep getting 0 as mysql_num_rows. $check = mysql_query("SELECT login FROM db_login WHERE login=\"$email\""); $check_rows = mysql_num_rows($check); if ($check_rows > 0) blablabla The result from $check_rows is always 0. I'm lost. Any help? Using 5.3.9 php. Quote Link to comment Share on other sites More sharing options...
thara Posted January 30, 2013 Share Posted January 30, 2013 Are you sure your query is correct? I mean your column name and table name (login & db_login). As well as from where the value come to $email? Quote Link to comment Share on other sites More sharing options...
shlumph Posted January 30, 2013 Share Posted January 30, 2013 You need to do some debugging. Do you get a row back when you run the same query in MySQL editor? Does this trigger an error? (Make sure display_errors is turned on in your php configuration) $check = mysql_query("SELECT login FROM db_login WHERE login=\"$email\"") or trigger_error(mysql_error()); Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 30, 2013 Share Posted January 30, 2013 Another consideration: Are you sure the value you *think* is in $mail actually exists in the DB? Could be that the original value and the value in $email were escaped, trimmed, etc. differently which would also explain why you get 0 results. Quote Link to comment Share on other sites More sharing options...
Gath Posted January 30, 2013 Author Share Posted January 30, 2013 Ok, thanks for answers, figured out the DB is broken, corrupted, or has some malfunction... after cleaning it all started to work just fine. Thanks again. 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.