CodeIgniter can't send email on hosted server

I'm currently working on a REST API using CodeIgniter. And I got an email verification system using the gmail smtp working just fine on localhost. But when I uploaded it to the hosted server it doesn't work.

I have where_in condition $this->db->where_in('student_id',$arr); Now I want to delete the contents present in $arr from a table using this code $this->db->delete('top_students'); But I got a database error

"You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ')' at line 2
DELETE FROM top_students WHERE student_id IN()"

Is there any chance that I can create a custom function for upload? I have 2 function which are insert_content() and insert_officials. In that function there is a code for uploading image. How will I do that since they have the same code of config.