Maybe this will help
PHP Code:
$getsomestuff = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "post WHERE userid='".$vbulletin->userinfo[userid]."' AND threadid=$threadinfo[threadid]");
$posted = $db->num_rows($getsomestuff);
if ($posted > 0)
{
}
else
{
$vbulletin->db->query_write("UPDATE user SET newpostcounter=newpostcounter+1 WHERE userid=" . $vbulletin->userinfo['userid'] . "");
}