Im no whizz at database queries at all, however i do know that when you get a string in a query you have to escape that at the end of the query.
If you are to write from another program to vbulletin i believe you have to clean the input variable. Here's an example of where a variable is cleaned:
PHP Code:
$vbulletin->input->clean_gpc('r', 'postid', TYPE_INT);
$postid = $vbulletin->GPC['postid'];
and then can be used like this
PHP Code:
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET mycolumnid = 0 WHERE postid = $postid");
}
That may be more confusing to you than help, hopefully KH99 (aka Kevin) will visit visit thread and help you out, i can only manage the simple stuff with db queries