Jump to content

Automatic posting script


wookie

Recommended Posts

I have this script working, its an automated posting script for a bulletin board, it posts one set of information, I would like it to post around 30-40 sets of information where position = 0 as in the "WHERE" from the query below. The area where I would like this to show is in the "$msgBody =  $query_results;" part, echo or print does not seem to work for $msgbody.I've gone round in circles this last few days attempting to write alternate queries and such. How can I get this script to produce more than just one result?

 

 

 

<?php

//These three files are needed for this script to work--adjust the path to suit your installation, a URL will not work.
require_once('/home/stev1965/public_html/foru/SSI.php');
require_once('/home/stev1965/public_html/foru/Sources/Post.php');
require_once('/home/stev1965/public_html/foru/Sources/Subs-Post.php');

$query = mysql_query("SELECT cpmsubtitle FROM stev1965_smf14.cpg14x_potdp WHERE position = 0") or die("Error: ".mysql_error());
while($smffetch=mysql_fetch_array($query))

{

	$memberid = $smffetch["cpmsubtitle"];  
	$registerdate= $smffetch["title"];  
                $query_results=$query_results . '<br>' . $memberid . ':  ' . $registerdate;
}


$query_results = $memberid . '<br>' . $registerdate; // builds the message body with the variables created..

$date = date("F j, Y");
$board = '5';  
$msgSubject = $date;

$msgBody =  $query_results;

$msgOptions = array(
	'id' => 0,
	'subject' => $msgSubject,
	'body' => $msgBody,
	'icon' => 'xx', ues
	'smileys_enabled' => 1, 
	'attachments' => empty($attachIDs) ? array() : $attachIDs,
	);
$topicOptions = array(
	'id' => empty($topic) ? 0 : $topic,
	'board' => $board,
	'poll' => null,
	'lock_mode' => 0,
	'sticky_mode' => null,
	'mark_as_read' => true,
	);
$posterOptions = array(
	'id' => $ID_MEMBER,
	'name' => 'Mr. Roboto', 
	'email' => '[email protected]', 
	'update_post_count' => 1 
	);

$newTopic = empty($topic) || $topic == 0;  

createPost($msgOptions, $topicOptions, $posterOptions); 

if (isset($topicOptions['id']))
	$topic = $topicOptions['id'];
if ($newTopic)
	notifyMembersBoard();
else
	sendNotifications($topic, 'reply');

?>

 

 

Many thanks!

 

Wookie

 

Link to comment
https://forums.phpfreaks.com/topic/95192-automatic-posting-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.