<p>I'm doing something like the following:</p>

<pre><code>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';
</code></pre>

<p>Im always getting error, I even echo $somepass and $myrow[1] they are the same, but still error. What Am I doing wrong? Thanks</p>

Try using
```
var_dump
```
instead 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 stored
```
Use VARCHAR or
```
trim()
```