trancetopia
11-08-2007, 08:00 PM
Hi,
I have successfully created a new thead and first post as part of a hack i'm putting together. I'm having problems with the next bit.
I'm checking in another table for data and if it relates to the thread i've just created, I want to add all the comments from the comment table as replies to the thread.
This is what i've got but it's not working or I should say it's not working in the loop:
$results = $db->query_read("SELECT userid, username, date, comment, ipaddress FROM comments WHERE photo = ". $ptphotoid . " ORDER BY date");
while ($result = $db->fetch_array($results))
{
// Insert Reply
$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);
$postuserid = $result['userid'];
$postpagetext = $result['comment'];
$threadinfo = fetch_threadinfo($formattedthreadid);
$foruminfo = fetch_foruminfo($forumid);
$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
$postdm->set('threadid', $formattedthreadid);
$postdm->set('userid', $postuserid);
$postdm->set('pagetext', $postpagetext);
$postdm->set('allowsmilie', 1);
$postdm->set('visible', 1);
$postdm->set('dateline', $result);
$postdm->save();
unset($postdm);
}
I've tried a number of variations on the above but can't get it to work.
Is anyone able to offer any pointers please. Hope someone can help.
Thanks.
--------------- Added [DATE]1194566079 at 1194566079 ---------------
I've worked it out now. Don't need help with this one.
I have successfully created a new thead and first post as part of a hack i'm putting together. I'm having problems with the next bit.
I'm checking in another table for data and if it relates to the thread i've just created, I want to add all the comments from the comment table as replies to the thread.
This is what i've got but it's not working or I should say it's not working in the loop:
$results = $db->query_read("SELECT userid, username, date, comment, ipaddress FROM comments WHERE photo = ". $ptphotoid . " ORDER BY date");
while ($result = $db->fetch_array($results))
{
// Insert Reply
$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);
$postuserid = $result['userid'];
$postpagetext = $result['comment'];
$threadinfo = fetch_threadinfo($formattedthreadid);
$foruminfo = fetch_foruminfo($forumid);
$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
$postdm->set('threadid', $formattedthreadid);
$postdm->set('userid', $postuserid);
$postdm->set('pagetext', $postpagetext);
$postdm->set('allowsmilie', 1);
$postdm->set('visible', 1);
$postdm->set('dateline', $result);
$postdm->save();
unset($postdm);
}
I've tried a number of variations on the above but can't get it to work.
Is anyone able to offer any pointers please. Hope someone can help.
Thanks.
--------------- Added [DATE]1194566079 at 1194566079 ---------------
I've worked it out now. Don't need help with this one.