based on your comment, your issue has nothing to do with CSV file creation/mysql. Your issue is you don't know how to send an email with an attachment in PHP.
Given you did not post the function emailcsv->sendEmail you probably need to add another parameter to accept a file location or however you decide to handle it. Either way here is the research for sending emails in PHP with attachments:
Send attachments in email php - Google Search[
^]
Send attachments with PHP Mail()? - Stack Overflow[
^]
PHP: Sending Email (Text/HTML/Attachments)[
^]
PHP mail attachment script and function | Tutdepot.com[
^]
You've stated you can create the csv and save it to local, that means you have the full path to that files location. You also said you can send an email using google...great. Now all you need to do is use the above links, a little brain power, and then you'll be able to send your csv file (an attachment) via email in php.