Converted MySQL Functions

Converted Mysql_query to $db->query(); mysql functions and added update
and delete functions