}
mysql_free_result(results2);
}
}
}
else //新数据,大部分 80%
{
r2 = random(273505);
r2 = r2+700000;
sprintf(sql, "SELECT COUNT(*) AS count FROM posts_jx3 WHERE tid = %d;",r2);
lr_log_message("%s",sql);
mysql_query(db, sql);
results2 = mysql_store_result(db);
while((record = mysql_fetch_row(results2)))
{
lr_log_message("count = %d", record[0]);
}
mysql_free_result(results2);
page = count/10;
lr_log_message("page = %d", page);
for(j=0;j< =page;j++)
{
sprintf(sql, "SELECT * FROM posts_jx3 WHERE tid = %d LIMIT %d,10;",r2,j);
lr_log_message("%s", sql);
mysql_query(db, sql);
if (j>0) {
results2 = mysql_store_result(db);
while((record = mysql_fetch_row(results2)))
{
lr_log_message("pid = %d", record[0]);
}
mysql_free_result(results2);
}
}
}
mysql_free_result(results2);
return 0;
}
int my_mysql_insert()
{
int t;
char sql[500];
MYSQL_RES *results3;
sprintf(sql,"%s","INSERT INTO posts_jx3 ( fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment, rate, ratetimes, status) VALUES ( 12345, 215053, 0, 'fdsafsdfsd', 2265065, '', 1240535917, 'fdsfsdfdsfd', '118.239.49.229', 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0);");
lr_log_message("%s", sql);
t = mysql_query(db, sql);
if(t)
{
lr_log_message("%s", mysql_error(db));
}
else
{
lr_log_message("%s", "suc");
}
}