mysql_options(real_conn, MYSQL_SET_CHARSET_NAME, "latin1");
mysql_query(real_conn, "INSERT INTO `char` (`char_id`, `account_id`, `char_num`, `name`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`,`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES ('1', '1', '1', '天', '1', '1', '1', '1', '1', '1', '1', '1', '1','1', '1','1', '1', 'a', '1', '1', 'b', '1', '1')");
mysql_query(real_conn, "select * from `char`");
res = mysql_store_result(real_conn);
long row_num = mysql_affected_rows(real_conn);
long col_num = mysql_field_count(real_conn);
printf("row:%lu col:%lu\n", (unsigned long)row_num, (unsigned long)col_num);
for(int i = 0; i < row_num; ++i)
{
MYSQL_ROW row_data = mysql_fetch_row(res);
for(int j = 0; j < col_num; ++j)
printf("%s\t", row_data[j]);
printf("\n");
}
mysql_free_result(res);
mysql_close(real_conn);
|