I use the following code to prefil a field with an amount from a database.
$amount = db_result(db_query('SELECT amount FROM {table} WHERE nid = %d', $fid));
$node->edit_user_fid = $amount;
If the query doesnt find anything it just shows empty. How can I get the value to be 0 if theres no results?
Or also writeable as
or if you’re sure that $amout is numerical (and it should be), use