have the following code:
function email_subscribers($tid,$post_id){
$sql = "SELECT thread_title FROM forum_threads WHERE thread_id = '" . $tid . "'";
$result = mysql_query($sql);
$result = mysql_fetch_array($result);
$thread_name = $result['thread_title'];//Get the title here
$post_name = get_user_name_from_id($post_id);
//Right we have the info shite
$sql = "SELECT * FROM `forum_subscriptions` WHERE `tid` = '" . $tid . "' && `notified` = '0';";
echo $sql;
$result = mysql_query($sql);
echo "
";
while ($row = mysql_fetch_array($result)) {
print_r($row);
$sql = "SELECT `user_name_unused`, `user_email` FROM date_profiles WHERE user_id = '" . $row['uid'] . "';";
$result = mysql_query($sql);
$result = mysql_fetch_assoc($result);
$Name = "Forum Subscriptions"; //senders name
$email = "subscriptions@partipeeps.com"; //senders e-mail adress
$recipient = $result['user_email']; //recipient
$mail_body = "Hey " . $result['user_name_unused'] . ",
\nThere has been a reply to a thread you are subscribed to entitled:
\n" . $thread_name . "
\nReponse posted by : " . $post_name . "
\nYou will not recieve any more email notifications to this thread until you next log in"; //mail body
$subject = "Subscription alert : " . $thread_name; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
mail($recipient, $subject, $mail_body, $header); //mail command
/*$sql = "UPDATE forum_subscriptions SET `notified` = '1' WHERE `uid` = '" . $row['uid'] . "' && `tid` = '" . $tid . "';";
if(!mysql_query($sql)){
echo mysql_error();
}*/
}
}
when run it only gets the first line for the results and nothing more.
also returns the error :
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/partipee/public_html/forum/reply_do.php on line 126
Line 126 is
while ($row = mysql_fetch_array($result)) {
Muchio gracias in advance