I'm trying to determine whether a database insert query was successful or not by checking the return value of
execute(), but it seems to be returning
0 even though I can see the data has been inserted into the database. The table I'm adding data to has a primary key but it's not set to auto increment.
$result = db_insert('my_table') ->fields(array( 'user_id' => $user_id, 'my_value' => $num, )) ->execute(); print_r($result); //Prints 0, even when successful
How can I check to see if the
db_insert() was successful or not if I'm not using an auto increment primary key?