PDA

View Full Version : I need further assistance


harmor19
10-26-2005, 11:18 AM
in a product I have


//get the last post created
$getpost = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "post WHERE postid ORDER BY postid DESC");
$post2 = $db->fetch_array($getpost);

$pagetext = $post2['pagetext'];


//if radio button is set to "positive" then display a positive random message
if ($_POST['random_reply'] == "pos")
{
$getrr = $db->query_read("SELECT * FROM " . TABLE_PREFIX ."random_reply WHERE ptext ORDER BY RAND()");
$rr = $db->fetch_array($getrr);

$rr = $rr['ptext'];

}

//if radio button is set to "negative" then get a negative random message
elseif ($_POST['random_reply'] == "neg")
{

$getrr = $db->query_read("SELECT * FROM " . TABLE_PREFIX ."random_reply WHERE ntext ORDER BY RAND()");
$rr = $db->fetch_array($getrr);

$rr = $rr['ntext'];
}

//if none are selected then have $rr insert as nothing
elseif ($_POST['random_reply'] == 0)
{
$rr = "";
}


//get the pagetext from the post table and a randon reply and combine them
$db->query_write("
UPDATE " . TABLE_PREFIX . "post
SET pagetext = '$pagetext $rr'
WHERE postid = " . $post2['postid'] . "
");

the above probably needs edited but I never got a chance to test it out.

I have three radio buttons in the newreply template
<input type="radio" name="random_reply" value="0">None
<input type="radio" name="random_reply" value="pos">Positive
<input type="radio" name="random_reply" value="neg">Negative

I just want to get the random reply and combine it with the post message like attachments do.

Marco van Herwaarden
10-26-2005, 01:15 PM
Didn't you already have a thread going about this? Please stay in 1 thread if it is about the same thing.