in reply to [untitled node, ID 193356]

I want to place my most common SQL queary formats in a subroutine and pass the parameters to it in sub calls. 90% of the time my results are perfect, 10% I get quirky errors.

Given your approach, 90/10 is about right. The thing that's tripping you up is quoting, and given the approach you're using, you're going to either have a sub that can handle about 90%, or you're going to push some real ugliness out to clients of the sub.

To insert "now()" into the query, you don't want the <quote>db_update_field</code> to be adding quotes. But to insert "t", you do. See the problem? For both to work, you need to push quoting out to the client, and do

db_update_field("users", $current_id, "last_seen_time", "now()"); db_update_field("users",$current_id,"last_seen_area","'$stuff'");
The second problem with your approach is that when you have a pair of values to update, you need to either invoke db_update_field twice (within a transaction), or you need to implement db_update_fields2, then db_update_fields3, then ... it keeps going downhill.

Instead a brittle, plug-in-the-pieces-to-run-a-query approach, build a set of routines that reflect the semantic actions you're performing.