Remove sql_prep function and all remaining mysql function calls