Jump to content

Recommended Posts

Hi,

 

i got problem in foreach loop, the code is stuck on first loop.

 

 

any one see any problem in the code?

im stuck on it for a day now.

 

thanks !



function get_rss()
{
global $catArray, $yesterday, $date;

$rss = mysql_query("SELECT id, cat, tcat, title, pic FROM portal_coverages WHERE v = 1 AND date BETWEEN ('" . $yesterday . "') AND ('" . $date . "')ORDER BY id DESC");
$resultp = array();


while($row = mysql_fetch_object($rss))
{
$resultp[$row -> cat][$row -> tcat] = $resultp[$row -> cat][$row -> tcat] . "
<tr>
<td><p style='color:#F91010;'>" . $catArray[$row -> cat . "," . $row -> tcat] . "</p></td>
<td><img src='http://dossinet.me/" . $row -> pic . "' width='50' height='50' /></td>
<td>" . $row -> title . "</td>
<td><a href='http://dossinet.me/view," . $row -> id . ".html'>קישור </a></td>
</tr>
";
}

return $resultp;
}



include("rss/mail_class.php");


$kk=1;
$query = mysql_query("SELECT rss_id, user_id FROM `portal_rss`")or die(mysql_error());
$get_rss = get_rss();


while($row = mysql_fetch_object($query))
{
$rss_id = unserialize($row -> rss_id);


foreach($rss_id as $key)
{
$x = explode(',', $key);

if(!empty($get_rss[$x[0]][$x[1]]))
{
$title .= $catArray[$key] . ', ';
$result .= $get_rss[$x[0]][$x[1]];
}
}

if(!empty($result))
{
$query = mysql_query("SELECT * FROM `user` WHERE `userid` ='" . $row -> user_id . "'")or die(mysql_error());
$rowz = mysql_fetch_array($query);

$user['name'] = $rowz['username'];
$user['email'] = $rowz['email'];

$params = array(
'file' => 'rss',
'subject' => "עדכוני קטגוריה - " . $title,
'from_name' => "עדכוני קטגוריה ",
'vars' => array('cat' => $title, 'post' => $result, 'name' => $user['name']),
);

Mail::To($user['email']);
Mail::set_mail($params, true);
Mail::send_mail($params);
}
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.