hi to all. thanks luiz and mike for response. my code is compiled when i use -lmysqlclient option and executable file is now exist but when i try to execute this file it prompts "segmentation error" .what's the meaning of it and what i have to do?
The code is as fillows: *********************************************************************** #include <stdio.h> #include <mysql.h> #define host "localhost" #define username "mysql" #define password "" #define database "test" MYSQL *conn; int main() { conn = mysql_init(NULL); mysql_real_connect(conn,host,username,password,database,0,NULL,0); MYSQL_RES *res_set; MYSQL_ROW row; unsigned int i; mysql_query(conn,"SELECT * FROM users WHERE userid=1"); res_set = mysql_store_result(conn); unsigned int numrows = mysql_num_rows(res_set); while ((row = mysql_fetch_row(res_set)) != NULL) { for (i=0; i<mysql_num_fields(res_set); i++) { printf("%s\n",row[i] != NULL ? row[i] : "NULL"); } } mysql_close(conn); return 0; } ***************************************************** Please help me --------------------------------- Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail Beta.