if (mysql_real_connect(...) == NULL) { string error_message = mysql_error(connection); . . . }
mysql_close(connection);