#define MYSQLSERVER "192.168.0.99"//mysql的ip
#define MYSQLUSERNAME "root"//用户名
#define MYSQLPASSWORD "123123"//密码
#define MYSQLDB "ultrax"//数据库
#define MYSQLPORT "3306"//端口
#include "Ptt_MySql.h"//引入mysql lib的h文件
vuser_init()
{
return 0;
}
Action()
{
char chQuery[128];
MYSQL *Mconn;
int result;
int i,j;
//引入libmysql的dll
lr_load_dll("libmysql.dll");
Mconn = lr_mysql_connect(MYSQLSERVER, MYSQLUSERNAME, MYSQLPASSWORD, MYSQLDB, atoi(MYSQLPORT));
//sprintf(chQuery,"SELECT uid,email,username FROM pre_common_member LIMIT 0,3;");
sprintf(chQuery,"select author,subject,message from pre_forum_post WHERE subject <>'' ORDER BY pid DESC LIMIT 0,20");
//sprintf(chQuery,"delete from pre_common_member where uid in(6,7,8,9) ");
//执行sql
result=lr_mysql_query(Mconn,chQuery);
//row=lr_mysql_
if(result==0){
lr_output_message("执行 成功");
}
else{
lr_error_message("执行 失败");
}
/*
过程
*/
//lr_save_string(row[0][0].cell,"aaa");
//lr_output_message(lr_eval_string("{aaa}"));
//lr_save_string(row[1][0].cell,"bbb");
//lr_output_message(lr_eval_string("{bbb}"));
lr_mysql_disconnect(Mconn);
return 0;
}
来源:https://www.cnblogs.com/stay-sober/p/4173706.html