<?php

function update_remove_i_owe_you_from_batch_no($iou_id, $row_state, $batch_no) {
    $sql = "UPDATE ".TB_PREF."i_owe_you  
                SET batch_no = 0, 
                row_state = ".db_escape(db_new_row_state($row_state))." 
            WHERE id = ".db_escape($iou_id)." 
                AND batch_no = ".db_escape($batch_no)." 
                AND row_state = ".db_escape($row_state);

    db_query($sql, "update_remove_i_owe_you_from_batch_no");
    return db_num_affected_rows();
}