Answer the question
In order to leave comments, you need to log in
Outputting an array to multiple files?
Hello, please tell me how to count the number of output lines in this array, or rather create a new array that will count and display a number in smarty?
global $db;
$limit_str = "";
if ($page) {
$limit_str = " limit " . $start . ", " . $no_per_page;
}
$messages_array = $db->fetchAssocList("select *, " . TABLE_MESSAGES . ".id as `msg_id`, " . TABLE_MESSAGES . ".pending as `pending`, date_format(" . TABLE_MESSAGES . ".`date`,'" . $date_format . "') as date_nice, " . TABLE_ADS . "." . $title_var . " as `title`, " . TABLE_MESSAGES . ".ip as ip from " . TABLE_MESSAGES . " left join " . TABLE_ADS . " on " . TABLE_ADS . ".id = " . TABLE_MESSAGES . ".ad_id left join " . TABLE_USERS . " on " . TABLE_USERS . ".id = " . TABLE_MESSAGES . ".`from` " . $where . " order by " . TABLE_MESSAGES . ".`" . $order . "` " . $order_way . $limit_str);
$i = 0;
foreach ($messages_array as $msg) {
$messages_array[$i]["message"] = cleanStr($messages_array[$i]["message"]);
$messages_array[$i]["title"] = cleanStr($messages_array[$i]["title"]);
$messages_array[$i]["from_contact_name"] = $msg[$settings["contact_name_field"]];
if ($messages_array[$i]["to"]) {
$contact_str = "";
if ($settings["contact_name_field"] != "email" && $settings["contact_name_field"] != "username") {
$contact_str = ", `" . $settings["contact_name_field"] . "`";
}
$user_info = $db->fetchAssoc("select email, username" . $contact_str . " from " . TABLE_USERS . " where id='" . $messages_array[$i]["to"] . "'");
$messages_array[$i]["to_contact_name"] = $user_info[$settings["contact_name_field"]];
$messages_array[$i]["to_email"] = $user_info["email"];
$messages_array[$i]["to_username"] = $user_info["username"];
}
$messages_array[$i]["blocked"] = $db->fetchRow("select count(*) from " . TABLE_BLOCKED_IPS . " where ip like '" . $messages_array[$i]["ip"] . "'");
$i++;
}
$no_messages = $this->noSearchMessages($where);
$this->no_messages = $no_messages;
return $messages_array;
}
if(!$_POST || !isset($post_array['type']) || !$post_array['type'])
$post_array['user_id'] = $crt_usr;
$smarty->assign("lng",$lng);
$smarty->assign("page",$page);
$smarty->assign("order",$order);
$smarty->assign("order_way",$order_way);
$smarty->assign("no_per_page",$no_per_page);
$smarty->assign("post_array",$post_array);
$messages_array=$msg->getMessages($post_array, $page,$no_per_page,$order,$order_way, 1);
$no_messages=$msg->getNoMessages();
$smarty->assign("no_messages",$no_messages);
$smarty->assign("messages_array",$messages_array);
{isset($messages_array) && $messages_array|@count}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question