This is driving me crazy... I'm trying to insert using prepared statement and the thing fails silently. Here's the code:
$sql = 'INSERT INTO payments (id_fix, name, date, comment, timestamp) VALUES (:id_fix, :name, :date, :comment, :timestamp)';
$q = $this->PDO->prepare($sql);
$a = array(
'id_fix' => $r['id'],
'name' => $r['name'],
'date' => $r['evt_date'],
'comment' => $this->comment,
'timestamp' => $r['timestamp']);
$q->execute($a) or die ('NAPAKA');
$r is from another query. I know I should do simple subquery but I'd like to solve this thing.
If I change
'id_fix' => 0
it works! If I echo $r['id'] it's a valid number.
'id_fix' => intval($r['id'])
won't work.
Any ideas? :-S