PDA

View Full Version : Creating new thread/post via MySql


altunozara
04-15-2009, 11:00 AM
$con = mysql_connect("***","***","***");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$repostinfo[0] = 86994;
$repostinfo[1] = 81628;
$repostinfo[2] = 1;
$repostinfo[3] = 'Altuno';
$repostinfo[4] = 1;
$repostinfo[5] = 'This is an automated post';
$repostinfo[6] = 1212220036;
$repostinfo[7] = 'This should be posted as soon as a thread is deleted, this post is automated under the name of Altuno';
$repostinfo[8] = 1;
$repostinfo[9] = 0;
$repostinfo[10] = '000.000.0.0';
$repostinfo[11] = 0;
$repostinfo[12] = 1;
$repostinfo[13] = 0;
$repostinfo[14] = 0;
$repostinfo[15] = 0;
$repostinfo[16] = 0;

mysql_select_db("gamingwe_forum", $con);$sql=("INSERT INTO post (postid, threadid, parentid, username, userid, title, dateline, pagetext, allowsmilie, showsignature, ipaddress, iconid, visible, attach, infraction, reportthreadid, post_thanks_amount)".
"VALUES
('$repostinfo[0]', '$repostinfo[1]', '$repostinfo[2]', '$repostinfo[3]', '$repostinfo[4]', '$repostinfo[5]', '$repostinfo[6]', '$repostinfo[7]', '$repostinfo[8]', '$repostinfo[9]', '$repostinfo[10]', '$repostinfo[11]', '$repostinfo[12]', '$repostinfo[13]', '$repostinfo[14]', '$repostinfo[15]', '$repostinfo[16]')");
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con);

when i use this code, it is input into as a row into the "post", but it is not shown on the forum liek every other row in "post"?

Kidillusion
04-22-2009, 02:57 AM
I would love to see the answer to this post. I also need to do mass insert scripts to import my posts.

Lynne
04-22-2009, 03:08 AM
Take a look in the articles forum on how to insert posts/threads using the datamanager. Just adding a row to the post table is not going to do it. There is necessary info to be added/updated in the thread table also. And the user table. And probably others that I don't feel like thinking about right now.

Dismounted
04-22-2009, 07:01 AM
Also see the manual: http://www.vbulletin.com/docs/html/data_managers