Here's some things I would add or change to make it more better
- Database connection would return connection variable.
- db_query should be altered to db_query(string* query, int connection)
- db_close should be altered to db_close(int connection);
- This allows multiple connections to be used (useful in some places).
- make db_connect(string* server, string* username, string* password); and db_select_database(string* database, int connection); or mix these, even though keeping these two separate does make it more agile (no need for new connection when hot switching databases)
- add useful functions such as db_num_rows, db_list_tables, etc.