tags:

views:

18

answers:

1
DB::construct();
$STH = DB::prepare('INSERT INTO users (username, password, email, activationkey) VALUES (?, UNHEX(?), ?, ?)');
var_dump($STH);
$result = $STH->execute(array('test', 'nils', '[email protected]', '227a038fe9c81515b514cb152188e95c'));

echo "working? <br />";
if($result == false) echo 'noooo...';

It outputs and doesn't put anything in the database. Works with a similare code with DPO just without my DB class. But I doesn't get any errors. Anyone have an idea what the problem could be?

object(PDOStatement)#2 (1) { ["queryString"]=> string(87) "INSERT INTO users (username, password, email, activationkey) VALUES (?, UNHEX(?), ?, ?)" }
working? <br /> noooo...
A: 

The code seems OK (ofcourse, don't know what you've done under the hood). Doesn't PDO itself generate an error / what does var_dump($STH->errorInfo()); say?

Wrikken
Found the problem. Should have been an SHA1 around the secound parameter in the execute array. Something about UnHEX thats not working when I don't
Knarf
Well, `SELECT 0x227a038fe9c81515b514cb152188e95c` does provide some weird bytes not suitable for a non-bin/blob column is seems.
Wrikken