I’m doing something like the following:
SELECT * FROM table WHERE user='$user'; $myrow = fetchRow() // previously I inserted a pass to the db using base64_encode ex: WRM2gt3R= $somepass = base64_encode($_POST['password']); if($myrow[1] != $somepass) echo 'error'; else echo 'welcome';
Im always getting error, I even echo $somepass and $myrow[1] they are the same, but still error. What Am I doing wrong? Thanks
Try using
var_dumpinstead of echo – maybe one of them has a space or newline at the start/end.Edit:
You must be storing it as CHAR(40):
A fixed-length string that is always right-padded with spaces to the specified length when storedUse VARCHAR or
trim()