views:

453

answers:

0

Hello,

My problem is the following

Y have two functions that are called from inside a function(method)

If the outcome of the first function is TRUE, the second function runs a select and an update query.

The second function runs a select with the query($sql) command The update query uses:

$stmt = $db->prepare($sql);
 $stmt->execute(arraywithvalues);

separatly, both functions work perfectly, but not when they are called both in other words, by the time the second function needs to be executed, it will fail. If I comment the first function out, it will execute fine?

EDIT

The update query

$tt = time() - 3600;
$w =array(NULL, NULL, $passw_new, $passw_key_new, $user_id);
$sql ="UPDATE table SET new_passw_requested =?";
$sql .=" WHERE passw_key_new='b02cdf33e46923de5a097c594e846764'";
$sql .=" AND UNIX_TIMESTAMP(new_passw_requested) >= $tt";
$sql .= " AND id=?";

The actual functions are. 1)can_reset_passw() wich runs a select query, 2) reset_passw() wich performs one select and then an update. Both functions work ok independantly like I said above.

error: Found one

SELECT * FROM table WHERE id = :id AND actief = :actief
Array ( [0] => SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens )

so something is messing with that

I try'd setting $stmt = NULL to clear resources, but that diddn't work. Somehow the tokens from the first select are still in memory, I think

What could I do to fix this?

solved

The last error set me on the right path. The dbabstraction class was holding de conditions in memory

thanks, Richard