How do I build a gateway to communicate between the game client and mySQL server?

How do I build a gateway to communicate between the game client and mySQL server? I assume the game client is hacked, so I need a middle man to take commands and send them to the mysql database. Is there a best practices I could follow or a tutorial I could find about this?

I already answered this for you here and gave full script examples on how to do it.