PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
You're not executing $query against the database.... just building a string containing the SQL and trying to display a result without actually generating a result.
In fact, $result[$query] is plain weird, you're trying to return the value of an array called $result, with an index of your SQL query. It's totally meaningless. Take a look at the PHP documentation for mySql to see how it should be done