本文整理汇总了PHP中db::fetch_array方法的典型用法代码示例。如果您正苦于以下问题:PHP db::fetch_array方法的具体用法?PHP db::fetch_array怎么用?PHP db::fetch_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db
的用法示例。
在下文中一共展示了db::fetch_array方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAddressBooksForUser
/**
* Returns the list of addressbooks for a specific user.
*
* @param string $principalUri
* @return array
*/
function getAddressBooksForUser($principalUri)
{
$sql = 'SELECT MAX(GREATEST(p.tms, s.tms)) lastupd FROM ' . MAIN_DB_PREFIX . 'socpeople as p
LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc
WHERE p.entity IN (' . getEntity('societe', 1) . ')
AND (p.priv=0 OR (p.priv=1 AND p.fk_user_creat=' . $this->user->id . '))';
$result = $this->db->query($sql);
$row = $this->db->fetch_array($result);
$lastupd = strtotime($row['lastupd']);
$addressBooks = [];
$addressBooks[] = ['id' => $this->user->id, 'uri' => 'default', 'principaluri' => $principalUri, '{DAV:}displayname' => 'Dolibarr', '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'Contacts Dolibarr ' . $this->user->login, '{http://calendarserver.org/ns/}getctag' => $lastupd, '{http://sabredav.org/ns}sync-token' => $lastupd];
return $addressBooks;
}
示例2: deleteCard
/**
* Deletes a card
*
* @param mixed $addressBookId
* @param string $cardUri
* @return bool
*/
function deleteCard($addressBookId, $cardUri)
{
debug_log("deleteContactObject( {$addressBookId} , {$cardUri} )");
if (!$this->user->rights->societe->contact->supprimer) {
return false;
}
if (strpos($cardUri, '-ct-') > 0) {
$contactid = $cardUri * 1;
// cardUri starts with contact id
} else {
$sql .= "SELECT `fk_object` FROM " . MAIN_DB_PREFIX . "socpeople_cdav\n\t\t\t\t\tWHERE `uuidext`= '" . $this->db->escape($cardUri) . "'";
// cardUri comes from external apps
$result = $this->db->query($sql);
if ($result !== false && ($row = $this->db->fetch_array($result)) !== false) {
$contactid = $row['fk_object'] * 1;
} else {
return false;
}
// not found
}
$sql = "UPDATE " . MAIN_DB_PREFIX . "socpeople SET ";
$sql .= " statut = 0, tms = NOW(), fk_user_modif = " . $this->user->id;
$sql .= " WHERE rowid = " . $contactid;
$res = $this->db->query($sql);
return true;
}
示例3: ON
/**
* Returns a list of calendars ID for a principal.
*
* @return array
*/
function _getCalendarsIdForUser()
{
debug_log("_getCalendarsIdForUser()");
$calendars = [];
if (!$this->user->rights->agenda->myactions->read) {
return $calendars;
}
if (!isset($this->user->rights->agenda->allactions->read) || !$this->user->rights->agenda->allactions->read) {
$onlyme = true;
} else {
$onlyme = false;
}
$sql = 'SELECT
u.rowid
FROM ' . MAIN_DB_PREFIX . 'actioncomm as a LEFT JOIN ' . MAIN_DB_PREFIX . 'actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type=\'user\'
LEFT JOIN ' . MAIN_DB_PREFIX . 'user u ON (u.rowid = ar.fk_element)
WHERE
a.entity IN (' . getEntity('societe', 1) . ')
AND a.code IN (SELECT cac.code FROM ' . MAIN_DB_PREFIX . 'c_actioncomm cac WHERE cac.type<>\'systemauto\')';
if ($onlyme) {
$sql .= ' AND u.rowid=' . $this->user->id;
}
$sql .= ' GROUP BY u.rowid';
$result = $this->db->query($sql);
while ($row = $this->db->fetch_array($result)) {
$calendars[] = $row['rowid'];
}
return $calendars;
}
示例4: while
/**
* Class constructor of diskspace. Gets reference for database connection.
* Builds self::taxclasses from database values.
*
* @param db Reference to database handler
*
* @author Former03 GmbH :: Florian Lippert <flo@syscp.org>
*/
function __construct($db)
{
$this->db = $db;
$default_taxclass_result = $this->db->query_first('SELECT `classid` FROM `' . TABLE_BILLING_TAXCLASSES . '` WHERE `default` = \'1\' LIMIT 0,1');
$this->default_taxclass = $default_taxclass_result['classid'];
$last_taxclass_validfrom = 0;
$taxclasses_result = $this->db->query('SELECT `taxclass`, `taxrate`, `valid_from` FROM `' . TABLE_BILLING_TAXRATES . '` ORDER BY `valid_from` ASC');
while ($taxclasses_row = $this->db->fetch_array($taxclasses_result)) {
if (!isset($this->taxclasses[$taxclasses_row['taxclass']]) || !is_array($this->taxclasses[$taxclasses_row['taxclass']])) {
$this->taxclasses[$taxclasses_row['taxclass']] = array();
}
$this->taxclasses[$taxclasses_row['taxclass']][$taxclasses_row['valid_from']] = $taxclasses_row;
if (isset($this->taxclasses[$taxclasses_row['taxclass']][$last_taxclass_validfrom]) && is_array($this->taxclasses[$taxclasses_row['taxclass']][$last_taxclass_validfrom]) && $taxclasses_row['valid_from'] != 0) {
$this->taxclasses[$taxclasses_row['taxclass']][$last_taxclass_validfrom]['valid_to'] = $taxclasses_row['valid_from'];
}
$last_taxclass_validfrom = $taxclasses_row['valid_from'];
}
}
示例5: print_report
public function print_report()
{
$db = new db();
$result = $db->query("select * from rfid order by ID desc limit 100");
echo "<table border='1'><tr><th>ID</th><th>GUID</th><th>DATE</th></tr>";
while ($row = $db->fetch_array($result)) {
echo "<tr><td>" . $row['ID'] . "</td><td>" . htmlspecialchars($row['guid']) . "</td><td>" . $row['date_created'] . "</td></tr>";
}
echo "</table>";
}
示例6: fetchData
/**
* This method fills the service_detail and service_templates.
*
* @param array The Ids to gather details for.
*
* @author Former03 GmbH :: Florian Lippert <flo@syscp.org>
*/
function fetchData($userIds = array())
{
if (!is_array($userIds)) {
$this->userIds = array(intval($userIds));
} else {
$this->userIds = $userIds;
}
unset($userIds);
if (is_array($this->toInvoiceTableData) && isset($this->toInvoiceTableData['table']) && $this->toInvoiceTableData['table'] != '' && isset($this->toInvoiceTableData['keyfield']) && $this->toInvoiceTableData['keyfield'] != '' && isset($this->toInvoiceTableData['condfield']) && $this->toInvoiceTableData['condfield'] != '') {
$toInvoiceTable_requiredFields = array($this->toInvoiceTableData['keyfield'], $this->toInvoiceTableData['condfield'], 'setup_fee', 'interval_fee', 'interval_length', 'interval_type', 'interval_payment', 'service_active', 'servicestart_date', 'serviceend_date', 'lastinvoiced_date');
$condition = '';
if (is_array($this->userIds) && !empty($this->userIds)) {
$condition = ' WHERE `' . $this->toInvoiceTableData['condfield'] . '` IN ( ' . implode(', ', $this->userIds) . ' ) ';
}
$toInvoice_result = $this->db->query('SELECT * FROM `' . $this->toInvoiceTableData['table'] . '` ' . $condition . ' ORDER BY `servicestart_date` ASC, `serviceend_date` ASC ');
while ($toInvoice_row = $this->db->fetch_array($toInvoice_result)) {
$rowOk = true;
reset($toInvoiceTable_requiredFields);
foreach ($toInvoiceTable_requiredFields as $fieldname) {
if (!isset($toInvoice_row[$fieldname])) {
$rowOk = false;
}
}
if ($rowOk && $toInvoice_row[$this->toInvoiceTableData['keyfield']] != '') {
$this->service_details[$toInvoice_row[$this->toInvoiceTableData['keyfield']]] = $toInvoice_row;
}
}
}
if (is_array($this->serviceTemplateTableData) && isset($this->serviceTemplateTableData['table']) && $this->serviceTemplateTableData['table'] != '' && isset($this->serviceTemplateTableData['keyfield']) && $this->serviceTemplateTableData['keyfield'] != '') {
$serviceTemplateTable_requiredFields = array($this->serviceTemplateTableData['keyfield'], 'setup_fee', 'interval_fee', 'interval_length', 'interval_type', 'interval_payment', 'taxclass', 'valid_from', 'valid_to');
$serviceTemplate_result = $this->db->query('SELECT * FROM `' . $this->serviceTemplateTableData['table'] . '` ORDER BY `valid_from` ASC, `valid_to` ASC ');
while ($serviceTemplate_row = $this->db->fetch_array($serviceTemplate_result)) {
$rowOk = true;
reset($serviceTemplateTable_requiredFields);
foreach ($serviceTemplateTable_requiredFields as $fieldname) {
if (!isset($serviceTemplate_row[$fieldname])) {
$rowOk = false;
}
}
if ($rowOk && $serviceTemplate_row[$this->serviceTemplateTableData['keyfield']] != '') {
if (!isset($this->service_templates[$serviceTemplate_row[$this->serviceTemplateTableData['keyfield']]]) || !is_array($this->service_templates[$serviceTemplate_row[$this->serviceTemplateTableData['keyfield']]])) {
$this->service_templates[$serviceTemplate_row[$this->serviceTemplateTableData['keyfield']]] = array();
}
$valid = $serviceTemplate_row['valid_from'] . ':' . $serviceTemplate_row['valid_to'];
$this->service_templates[$serviceTemplate_row[$this->serviceTemplateTableData['keyfield']]][$valid] = $serviceTemplate_row;
}
}
}
$this->defaultvalues = array('interval_fee' => '0.00', 'interval_length' => '0', 'interval_type' => 'y', 'interval_payment' => '0', 'setup_fee' => '0.00', 'taxclass' => '0', 'service_type' => '', 'caption_setup' => '', 'caption_interval' => '');
}
示例7: clientesFone
function clientesFone()
{
$db = new db("../config.php");
$db->_DEBUG = 1;
$json = new Services_JSON();
$rs = $db->executa($db->getAll("clientes", "(cli_nome = '" . $_GET["cli_nome"] . "'\n \t AND cli_foneprinc = " . $_GET["cli_fone"] . ")\n \t or (cli_nome = '" . $_GET["cli_nome"] . "' and cli_ruaid = " . $_GET["rua_id"] . ")\n \t ", '', 0));
if ($db->num_rows > 0) {
while ($ln = $db->fetch_array($rs)) {
$itens[] = array("cli_id" => $ln["cli_id"], "tem" => "S");
}
} else {
$itens[] = array("tem" => "N");
}
$str = $json->encode($itens);
return $str;
}
示例8: getAvailableColumns
private function getAvailableColumns()
{
$res = db::query("\n SELECT sc.name, sc.on_execute, sc.internal_name\n FROM " . TBL_PREF . "submodule_columns sc\n JOIN " . TBL_PREF . "modules m ON m.id = sc.module_id\n JOIN " . TBL_PREF . "submodules sm ON sm.id = sc.submodule_id\n WHERE m.internal_name = '" . db::input($this->module) . "'\n AND sm.name = '" . db::input($this->submodule) . "'\n ");
$result = array();
while ($row = db::fetch_array($res)) {
if (isset($result[$row['internal_name']])) {
$temp = $result[$row['internal_name']];
unset($result[$row['internal_name']]);
$result[$row['internal_name']][] = $temp;
$result[$row['internal_name']][] = array('name' => $row['name'], 'handler' => $row['on_execute']);
} else {
$result[$row['internal_name']] = array('name' => $row['name'], 'handler' => $row['on_execute']);
}
}
$this->availableColumns = $result;
}
示例9: trazItens
function trazItens($cpi_id)
{
$db = new db("../config.php");
$db->_DEBUG = 1;
$json = new Services_JSON();
$rs = $db->executa($db->getAll("catprodutos_itens", "cpi_id={$cpi_id}", '', 0));
if ($db->num_rows > 0) {
while ($ln = $db->fetch_array($rs)) {
$itens = array("cpi_id" => $ln["cpi_id"], "cpi_item" => urlencode($ln["cpi_item"]), "tem" => "S");
}
} else {
$itens = array("tem" => "N");
}
$str = $json->encode($itens);
return $str;
}
示例10: correctMysqlUsers
/**
* This file is part of the SysCP project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.syscp.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
* @package Functions
* @version $Id$
*/
function correctMysqlUsers($mysql_access_host_array)
{
global $db, $settings, $sql, $sql_root;
foreach ($sql_root as $mysql_server => $mysql_server_details) {
$db_root = new db($mysql_server_details['host'], $mysql_server_details['user'], $mysql_server_details['password'], '');
unset($db_root->password);
$users = array();
$users_result = $db_root->query('SELECT * FROM `mysql`.`user`');
while ($users_row = $db_root->fetch_array($users_result)) {
if (!isset($users[$users_row['User']]) || !is_array($users[$users_row['User']])) {
$users[$users_row['User']] = array('password' => $users_row['Password'], 'hosts' => array());
}
$users[$users_row['User']]['hosts'][] = $users_row['Host'];
}
$databases = array($sql['db']);
$databases_result = $db->query('SELECT * FROM `' . TABLE_PANEL_DATABASES . '` WHERE `dbserver` = \'' . $mysql_server . '\'');
while ($databases_row = $db->fetch_array($databases_result)) {
$databases[] = $databases_row['databasename'];
}
foreach ($databases as $username) {
if (isset($users[$username]) && is_array($users[$username]) && isset($users[$username]['hosts']) && is_array($users[$username]['hosts'])) {
$password = $users[$username]['password'];
foreach ($mysql_access_host_array as $mysql_access_host) {
$mysql_access_host = trim($mysql_access_host);
if (!in_array($mysql_access_host, $users[$username]['hosts'])) {
$db_root->query('GRANT ALL PRIVILEGES ON `' . str_replace('_', '\\_', $db_root->escape($username)) . '`.* TO `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` IDENTIFIED BY \'password\'');
$db_root->query('SET PASSWORD FOR `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` = \'' . $db_root->escape($password) . '\'');
}
}
foreach ($users[$username]['hosts'] as $mysql_access_host) {
if (!in_array($mysql_access_host, $mysql_access_host_array)) {
$db_root->query('REVOKE ALL PRIVILEGES ON * . * FROM `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '`');
$db_root->query('REVOKE ALL PRIVILEGES ON `' . str_replace('_', '\\_', $db_root->escape($username)) . '` . * FROM `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '`');
$db_root->query('DELETE FROM `mysql`.`user` WHERE `User` = "' . $db_root->escape($username) . '" AND `Host` = "' . $db_root->escape($mysql_access_host) . '"');
}
}
}
}
$db_root->query('FLUSH PRIVILEGES');
$db_root->close();
unset($db_root);
}
}
示例11: __construct
public function __construct()
{
$db = new db();
$this->most_recent_object = false;
$result = $db->query("select * from touch order by ID desc limit 100");
$output = "";
$output .= "<table border='1'>";
$output .= "<tr><th>ID</th><th>X</th><th>Y</th><th>TYPE</th><th>DATE</th></tr>";
$downs = array();
$downs_index = 0;
while ($row = $db->fetch_array($result)) {
$output .= "<tr ";
if ($row['type_percent'] == 1) {
//type_percent 1 is "down" (as opposed to up or move which could be detected as well in the future)
//collect the last 3
if ($downs_index <= 2 && !$this->down_already_exists($downs, $row['x_percent'], $row['y_percent'])) {
$downs[$downs_index] = new stdClass();
$downs[$downs_index]->x = $row['x_percent'];
$downs[$downs_index]->y = $row['y_percent'];
$downs[$downs_index]->timestamp = strtotime($row['date_created']);
$downs_index++;
}
//}
}
$output .= "><td>" . $row['ID'] . "</td><td>" . $row['x_percent'] . "</td><td>" . $row['y_percent'] . "</td><td>" . $this->type_to_english($row['type_percent']) . "</td><td>" . $row['date_created'] . "</td></tr>";
}
$output .= "</table>";
$this->output = $output;
if (count($downs) == 3) {
//check if timestamps are close; logic is that if an object is placed on the captouch all 3 points should be recorded in less than 1 second. If > 1 second they are likely not related.
if (abs($downs[0]->timestamp - $downs[1]->timestamp) <= 1 && abs($downs[2]->timestamp - $downs[1]->timestamp) <= 1) {
$this->most_recent_object = $downs;
$this->determine_objects_orientation();
}
}
}
示例12: db
<?php
error_reporting(E_ALL);
$listaYear = '';
$listaComunidades = '';
include 'class.db.php';
include 'config.php';
$db = new db();
$db->connectdb($host, $user, $pass, $database);
$query = $db->query("SELECT id,comunidad FROM comunidades");
while ($data = $db->fetch_array($query)) {
$listaComunidades .= '<option value="' . $data['id'] . '">' . $data['comunidad'] . '</option>';
}
for ($x = 2003; $x < 2009; $x++) {
$listaYear .= '<option value="' . $x . '">' . $x . '</option>';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Comunidades Autónomas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style1.css" rel="stylesheet" type="text/css" />
<link href="formstyle.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="jquery.form.js"></script>
</head>
<body>
<div id="main">
示例13: array
*/
error_reporting(E_ALL);
session_name("lito");
session_start();
$sid = session_id();
setlocale(LC_ALL, array('de_DE', 'de_DE@euro', 'de', 'ger'));
define('TIMESTAMP', time());
define('LITO_ROOT_PATH', dirname(__FILE__) . '/../');
define('LITO_INCLUDES_PATH', LITO_ROOT_PATH . 'includes/');
require LITO_INCLUDES_PATH . 'config.php';
require LITO_INCLUDES_PATH . 'class_db_mysqli.php';
$db = new db($dbhost, $dbuser, $dbpassword, $dbbase);
if (isset($_SESSION['userid'])) {
$db = new db($dbhost, $dbuser, $dbpassword, $dbbase);
$result_id = $db->query("SELECT design_id FROM cc" . $n . "_users where userid ='" . $_SESSION['userid'] . "'");
$row_id = $db->fetch_array($result_id);
if (intval($row_id['design_id']) > 0) {
$theme_1 = $db->query("SELECT `design_name` FROM `cc" . $n . "_desigs` WHERE `design_id` = '" . $row_id['design_id'] . "'");
$row_theme = $db->fetch_array($theme_1);
define("LITO_THEMES", $row_theme['design_name']);
}
} else {
define("LITO_THEMES", 'standard');
}
// e.g. /srv/www/vhosts/freebg.de/subdomains/dev/httpdocs/
define('LITO_ROOT_PATH_URL', $litotex_url);
// e.g. http://dev.freebg.de/
define('LITO_CACHE_PATH', LITO_ROOT_PATH . 'cache/');
// e.g. /srv/www/vhosts/freebg.de/subdomains/dev/httpdocs/cache/
define("LITO_THEMES_PATH", LITO_ROOT_PATH . 'themes/' . LITO_THEMES . '/');
// e.g. srv/www/vhosts/freebg.de/subdomains/dev/httpdocs/themes/standard/
示例14: json_encode
/*
* RFID reader reads a tag and passes it to this script. This writes that value to the database.
*/
require_once $_SERVER['DOCUMENT_ROOT'] . "/db.php";
header('Content-Type: application/json');
if (!isset($_POST['rfid_api_guid']) || trim($_POST['rfid_api_guid']) == "") {
echo json_encode(array("success" => false));
return false;
}
$db = new db();
$guid = $_POST['rfid_api_guid'];
if ($guid == "(No Tags)" || $guid == "") {
echo json_encode(array("success" => false));
return false;
}
if (strpos($guid, ", Disc") !== false) {
$guid = substr($guid, 0, strpos($guid, ", Disc"));
$guid = str_replace("Tag:", "", $guid);
$guid = trim($guid);
$guid = str_replace(" ", "", $guid);
//remove spaces
}
$guid = $db->cl($guid);
//prevent duplicates; every object should have it's own unique GUID. In the future it'd be better to move to MIT's EPC format (combining both an EPC_ID & TAG_ID allowing anti-duplication to be testing against TAG_ID and not EPC_ID therefore allowing unlimited of the same type of objects)
$result = $db->query("select * from rfid where guid = '{$guid}' limit 1");
if ($row = $db->fetch_array($result)) {
echo json_encode(array("success" => false));
return false;
}
$db->query("insert into rfid values(NULL,'{$guid}',NOW())");
echo json_encode(array("success" => true));
示例15: int
$db->query(createtable("CREATE TABLE " . UC_DBTABLEPRE . "pms_tmp (\r\n\t\t pmid int(11) unsigned NOT NULL auto_increment,\r\n\t\t msgfrom varchar(255) NOT NULL default '',\r\n\t\t msgfromid int(11) unsigned NOT NULL default '0',\r\n\t\t msgtoid int(11) unsigned NOT NULL default '0',\r\n\t\t folder enum('inbox','outbox') NOT NULL default 'inbox',\r\n\t\t new tinyint(1) NOT NULL default '0',\r\n\t\t subject varchar(255) NOT NULL default '',\r\n\t\t dateline int(11) unsigned NOT NULL default '0',\r\n\t\t message text NOT NULL,\r\n\t\t delstatus tinyint(1) unsigned NOT NULL default '0',\r\n\t\t related int(11) unsigned NOT NULL default '0',\r\n\t\t fromappid INT(11) UNSIGNED NOT NULL DEFAULT '0',\r\n\t\t PRIMARY KEY(pmid),\r\n\t\t KEY msgtoid(msgtoid,folder,dateline),\r\n\t\t KEY msgfromid(msgfromid,folder,dateline),\r\n\t\t KEY related (related),\r\n\t\t KEY getnum (msgtoid,folder,delstatus)\r\n\t\t) TYPE=MyISAM", UC_DBCHARSET));
$totalcount = $db->result_first("SELECT count(*) FROM " . UC_DBTABLEPRE . "pms");
echo 'Converted the user short messages: 0.0000% ......';
redirect('pmconvert.php?step=2&totalcount=' . $totalcount);
} elseif ($step == 2) {
$totalcount = isset($_GET['totalcount']) ? intval($_GET['totalcount']) : 0;
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
$msgfromid = isset($_GET['msgfromid']) ? intval($_GET['msgfromid']) : 0;
$msgtoid = isset($_GET['msgtoid']) ? intval($_GET['msgtoid']) : 0;
$query = $db->query("SELECT * FROM " . UC_DBTABLEPRE . "pms ORDER BY msgfromid, msgtoid, dateline DESC LIMIT {$start}, {$limit}");
if (!$db->num_rows($query)) {
echo 'The user short message conversion is completed ...';
redirect('pmconvert.php?step=3&totalcount=' . $totalcount);
} else {
$last = $db->fetch_first("SELECT * FROM " . UC_DBTABLEPRE . "pms_tmp ORDER BY pmid DESC LIMIT 1");
while ($pm = $db->fetch_array($query)) {
if ($pm['folder'] == 'inbox' && $pm['msgfromid'] > 0 && $pm['msgtoid'] > 0) {
if ($msgfromid != $pm['msgfromid'] || $msgtoid != $pm['msgtoid']) {
insertrow($pm, 0);
}
if ($last['subject'] != $pm['subject'] || $last['message'] != $pm['message'] || $last['dateline'] != $pm['dateline'] || $last['msgtoid'] != $pm['msgtoid']) {
insertrow($pm, 1);
}
$msgfromid = $pm['msgfromid'];
$msgtoid = $pm['msgtoid'];
$last = $pm;
} else {
insertrow($pm, 0);
}
}
$start += $limit;