garten

annotate game.h @ 1:3ff1fbe4693d

moved gamecheck and some vars out
author meillo@marmaro.de
date Wed, 14 May 2008 21:07:33 +0200
parents
children 176ee28e7464
rev   line source
meillo@1 1 char query[1024];
meillo@1 2 char* gamename;
meillo@1 3 int gameid;
meillo@1 4 int gametime;
meillo@1 5
meillo@1 6
meillo@1 7 void check_game() {
meillo@1 8 int rows;
meillo@1 9 MYSQL_ROW row;
meillo@1 10
meillo@1 11 sprintf(query, "select id, time from game where name = '%s' ", gamename);
meillo@1 12 db_query(query);
meillo@1 13 result = mysql_store_result(conn);
meillo@1 14 rows = mysql_num_rows(result);
meillo@1 15 row = mysql_fetch_row(result);
meillo@1 16 gameid = atoi(row[0]);
meillo@1 17 gametime = atoi(row[1]);
meillo@1 18 mysql_free_result(result);
meillo@1 19
meillo@1 20 if (rows != 1) {
meillo@1 21 printf("game '%s' does not exist\n", gamename);
meillo@1 22 exit(1);
meillo@1 23 }
meillo@1 24 }
meillo@1 25