Ответить на сообщение
Вернуться к теме
Вы отвечаете на сообщение:
Автор: GeorgeIV (12.08.2008 в 17:22)
// gsbcon.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <windows.h> #include <winbase.h> #include <winsock.h> #include <my_global.h> #include <mysql.h> MYSQL mysql; MYSQL_RES *res; MYSQL_ROW row; void die(void) { printf("%sn", mysql_error(&mysql)); } int _tmain(int argc, _TCHAR* argv[]) { unsigned int i = 0; if (!mysql_init (&mysql)) return 1; if (!(mysql_real_connect(&mysql,"HOST","USER","PASSWORD", "BD", 3306 , NULL , 0))) {die();return 1;} if (mysql_select_db(&mysql,"apachelogs")) { die();return 1;} if (mysql_query(&mysql,"SELECT * FROM access_log_history LIMIT 1")) { die();return 1;} if (!(res = mysql_store_result(&mysql))) { die();return 1;} while((row = mysql_fetch_row(res))) { for (i = 0 ; i < mysql_num_fields(res); i++) printf("%st",row[i]); printf ("n"); } if (!mysql_eof(res)) { die();return 1;} mysql_free_result(res); mysql_close(&mysql); return 0; }
Ваше имя:
Пароль:
Цитировать Используйте тэги для выделения текста: Код: [code][/code] Жирный: [b][/b] Наклонный: [i][/i] URL: [url][/url]
Сообщение:
Прикрепить: