gcc -o test test.c /usr/local/lib/mysql/libmysqlclient.dylib
Multiple client stations would be able to add records and view
records from different Macs, all sharing the one central MySQL
server database. Sounds pretty simple, right ?
you have to setup mysql to authorize
extern connexions from the clients
but i think it's not the mailing list to post this ?
#define table "yourtable"
#define host "localhost"
#define user "user"
#define pass "pass"
#define db "database"
int main()
{
MYSQL mysql;
MYSQL_RES *res;
MYSQL_ROW row;
int i=0;
char query[50];
/* make connection to the database */
if(!(mysql_connect(&mysql,host,user,pass)))
{
fprintf(stderr,"mysql_connect() Failed: %s\n",mysql_error
(&mysql));
exit(1);
}
/* the database we will use */
if(mysql_select_db(&mysql,db))
{
fprintf(stderr,"mysql_select_db() Failed: %s\n", mysql_error
(&mysql));
exit(1);
}
/* Setup the query */
sprintf(query,"select * from %s", table);
if(mysql_query(&mysql,query))
{
fprintf(stderr,"mysql_query() Failed: %s\n", mysql_error
(&mysql));
exit(1);
}
/* store the result from our query */
res = mysql_store_result(&mysql);
/* fetch each row from our result and print it */
while((row = mysql_fetch_row(res))) {
for(i=0;i<mysql_num_fields(res);i++)
printf("%s\n",row[i]);
}
/* clean up */
mysql_free_result(res);
mysql_close(&mysql);
}
I"It's making my eyes better. And it's legal. I could walk up to the
President and blow smoke in his stupid monkey face, and he'd just
have to sit there groovin' on it!" Homer J Simpson, Springfield,
Illinois, Massachusetts nobody knows :)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden