garten
view 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 |
line source
1 char query[1024];
2 char* gamename;
3 int gameid;
4 int gametime;
7 void check_game() {
8 int rows;
9 MYSQL_ROW row;
11 sprintf(query, "select id, time from game where name = '%s' ", gamename);
12 db_query(query);
13 result = mysql_store_result(conn);
14 rows = mysql_num_rows(result);
15 row = mysql_fetch_row(result);
16 gameid = atoi(row[0]);
17 gametime = atoi(row[1]);
18 mysql_free_result(result);
20 if (rows != 1) {
21 printf("game '%s' does not exist\n", gamename);
22 exit(1);
23 }
24 }