Edit:
Seriously my man, you need to start using the CI DB class, this is not a good practice.
First of all, try getting your query in a var and exit it to the screen. Then see what the actual query gets and try this in your PHPMYADMIN. I suspect errors with the $name var.
===========================================================================
It looks like you didn't select a database.
Try using Code Igniters DB class?
If you don't already do,
$this->db->query('select name from reseller_domain where name='".$name."');
Must say though you'd better read the docs about it, it might help you a little further. If you did the query with the CI Db class you might want to see the actually outputted query with:
exit($this->db->last_query()); //yes exit isn't good, not even for debugging. But it works.
Then see what goes wrong inside of your query.