#define MySQLServer "192.168.0.99"//mysql IP
#define MYSQLUSERNAME "root"//user Name
#define MYSQLPASSWORD "123123"//Password
#define MYSQLDB "Ultrax"//Database
#define MYSQLPORT "3306"//Port
#include "ptt_mysql.h"//h file introduced in MySql Lib
Vuser_init ()
{
return 0;
}
Action ()
{
Char chquery[128];
MYSQL *mconn;
int result;
int i,j;
Introduction of Libmysql DLLs
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)");
/Execute SQL
result=lr_mysql_query (mconn,chquery);
//row=lr_mysql_
if (result==0) {
lr_output_message ("Successful Execution");
}
else{
Lr_error_message ("Failed execution");
}
/*
Process
*/
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;
}
LR Access MySQL