SQL: error HY00 when trying to insert values into a database

When I run this PHP code:

DB::query('INSERT INTO logintoks VALUES (NULL, :tok, :uid)', array(':tok'=>$token_sha, ':uid'=>$userid));

I get this error:

SQLSTATE[HY000]: General error

And when I try running the same statement in phpMyAdmin, I don’t get any errors.