sub : help on glade.
Hi This is sameer working in software devision in MIC Electronics.We are devoloping a project in LINUX with GLADE and using MY-SQL as back-end. 1) I compiled GLADE application using ---> make ---> makeinstall --- > ./filename and i got output for all the programs. 2) Later i have written a program(using C) and got connected to MYSQL database. Here i compiled this program using ---> gcc programname.c -L usr/lib/mysql Now the problem occured while compiling embeded mysql source in callbacks.c. I need procedure that tells how to compile callbacks.c after adding mysql.h(for me it is giving errors while "make" reference to mysql is not available). Program: #include #include #include #include #include #define MYSQL_HOST "localhost" // database server name#define MYSQL_DB "clists" // database name#define MYSQL_USERID "hugolin" // database user id #define MYSQL_PASSWD "tristan" // userid password#define MYSQL_TABLE "clist" // table name /* User clicked the "Add List" button. */void button_add_clicked( gpointer data ){ int indx; /* Something silly to add to the list. 4 rows of 2 columns each */ /* gchar *drink[4][2] = { { "Milk", "3 Oz" }, /* { "Water", "6 l" }, /* { "Carrots", "2" }, /* { "Snakes", "55" } };*/ gchar *drink[2]; /* Here we do the actual adding of the text. It's done once for * each row. */ MYSQL mysql; MYSQL_RES *result; MYSQL_ROW row; unsigned int num_fields; int record_count; char query_str[100]; mysql_init(&mysql); if (!mysql_connect(&mysql,MYSQL_HOST,MYSQL_USERID,MYSQL_PASSWD)) { printf("Failed to connect to database: Error:%s\n",mysql_error(&mysql)); return; } if (mysql_select_db(&mysql,MYSQL_DB)) { printf("Failed to select table: Error: %s\n",mysql_error(&mysql)); mysql_close(&mysql); return; } strcpy(query_str,"SELECT * FROM "); strcat(query_str,MYSQL_TABLE); mysql_query(&mysql,query_str); result = mysql_use_result(&mysql); while ((row = mysql_fetch_row(result))) { drink[0]=row[1]; drink[1]=row[2]; gtk_clist_append ((GtkCList *)data, drink); record_count++; } mysql_close(&mysql); return;}It will be of great help for me, so please let me know the solution to move forward. Thank In AdvanceSameer.T
information regarding glade
Hi This is sameer working in software devision in MIC Electronics.We are devoloping a project in LINUX with GLADE and using MY-SQL as back-end. 1) I compiled GLADE application using ---> make ---> makeinstall --- > ./filename and i got output for all the programs. 2) Later i have written a program(using C) and got connected to MYSQL database. Here i compiled this program using ---> gcc programname.c -L usr/lib/mysql Now the problem occured while compiling embeded mysql source in callbacks.c. I need procedure that tells how to compile callbacks.c after adding mysql.h(for me it is giving errors while "make" reference to mysql is not available). Program: #include #include #include #include #include #define MYSQL_HOST "localhost" // database server name#define MYSQL_DB "clists" // database name#define MYSQL_USERID "hugolin" // database user id #define MYSQL_PASSWD "tristan" // userid password#define MYSQL_TABLE "clist" // table name /* User clicked the "Add List" button. */void button_add_clicked( gpointer data ){ int indx; /* Something silly to add to the list. 4 rows of 2 columns each */ /* gchar *drink[4][2] = { { "Milk", "3 Oz" }, /* { "Water", "6 l" }, /* { "Carrots", "2" }, /* { "Snakes", "55" } };*/ gchar *drink[2]; /* Here we do the actual adding of the text. It's done once for * each row. */ MYSQL mysql; MYSQL_RES *result; MYSQL_ROW row; unsigned int num_fields; int record_count; char query_str[100]; mysql_init(&mysql); if (!mysql_connect(&mysql,MYSQL_HOST,MYSQL_USERID,MYSQL_PASSWD)) { printf("Failed to connect to database: Error:%s\n",mysql_error(&mysql)); return; } if (mysql_select_db(&mysql,MYSQL_DB)) { printf("Failed to select table: Error: %s\n",mysql_error(&mysql)); mysql_close(&mysql); return; } strcpy(query_str,"SELECT * FROM "); strcat(query_str,MYSQL_TABLE); mysql_query(&mysql,query_str); result = mysql_use_result(&mysql); while ((row = mysql_fetch_row(result))) { drink[0]=row[1]; drink[1]=row[2]; gtk_clist_append ((GtkCList *)data, drink); record_count++; } mysql_close(&mysql); return;}It will be of great help for me, so please let me know the solution to move forward. Thank In AdvanceSameer.T