removed unused parameters and code
comment corrected
statement transferred to the else condition
invalid $unlim_num_rows error corrected