#include <stdio.h>
#include <stdlib.h>
#include <mysql/mysql.h>
int main(int argc, char *argv[])
{
MYSQL *my_con = malloc( sizeof(MYSQL) );
MYSQL_RES *my_res;
MYSQL_FIELD *my_field;
MYSQL_ROW my_row;
int rows, i;
int res;
int a[2] = {51,2};
printf("%3d ",a[0]);
mysql_init(my_con);
my_con = mysql_real_connect(my_con, "localhost", "root", "
jwn.com",
"jwn", 0, NULL, CLIENT_FOUND_ROWS);
if( NULL == my_con )
error_quit("Connection fail", my_con);
printf("Connection success\n");
res = mysql_query(my_con,
"insert into class1(name, age, birthday) value('abc', 52, NOW());");
mysql_free_result(my_res);
mysql_close(my_con);
free(my_con);
return 0;
}
==============
想要实现 int a[2] = {51,2}; 中的元素 插入 res = mysql_query(my_con,
"insert into class1(name, age, birthday) value('abc', 52, NOW());"); 代替 52 插入51,请帮忙构造一个语句,多谢