function getResultList($sql) { //echo $sql."<br />"; if (empty($GLOBALS['num_results'])) { $GLOBALS['num_results'] = countQuery($sql); } require_once XOX_LIB . '/database/result_navigation.php'; $add = array(); if ($GLOBALS['num_results'] && ($rs = executeQuery($sql . $GLOBALS['result_navigation']))) { while ($row = $rs->getrow()) { $add[] = $row; } return $add; } }
<?php require_once dirname(__FILE__) . '/dummy.php'; require_once dirname(__FILE__) . '/inc.sqltables.php'; if (!isset($data)) { $data = array('headline' => 'Newsletter', 'body' => 'Here you can view, edit, copy and delete your existing newsletters, or add new newsletters.', 'tablehead' => array('Title', 'Subject', 'Status'), 'link' => array("edit" => "#", "new" => "#", "detail" => "#", 'delete' => '#', 'copy' => '#', 'save' => '#')); } $data['data'] = 'SELECT a.id, a.name, a.description, count(b.id) AS issues FROM ' . $SQLTable['newsletter'] . ' AS a LEFT JOIN issue AS b ON b.newsletter_id=a.id WHERE a.domain_id=' . $GLOBALS['tnl_domain_id'] . " GROUP BY a.id ORDER BY a.sort, a.changed"; $GLOBALS['num_results'] = countQuery($data['data'], 'a.id'); $data['buttons'] = 385; echo drawList($data);
function query($sql) { $this->num_rows = countQuery($sql); $data = array(); if ($this->paging) { $GLOBALS['num_results'] = $this->num_rows; require XOX_LIB . '/database/result_navigation.php'; $sql .= $GLOBALS['result_navigation']; } if ($rs = executeQuery($sql)) { while ($row = $rs->getrow()) { $data[] = $row; } $rs->free(); } $this->setData($data); }
{ if ($db != "") { connect($db); } else { connect("spaceman"); } $result = mysql_query($query); $err = mysql_error(); if ($err != "") { echo "error={$err} "; } $ret = array(); $x = 0; return mysql_affected_rows(); } $xcount = countQuery($sql2, "spaceman"); function query($query, $db) { global $xcount, $range; if ($db != "") { connect($db); } else { connect("spaceman"); } $result = mysql_query($query); $err = mysql_error(); if ($err != "") { echo "error={$err} "; } return $result; }
} // set num results to total of news and teaser entries $GLOBALS['num_results'] = countQuery("SELECT id FROM " . $SQLTable['content'] . $where); $GLOBALS['max_results_per_page'] = 200; if (isset($issue_id)) { $issue = new cIssue($issue_id); $nl = $issue->getNewsletter(); $tm = new xoxNewsletterTheme($nl->template_html); $first = true; $all_subs = array(); foreach ($tm->sub_name as $sub => $name) { $data['tablehead'] = array($name, 'Text'); $sqls = "SELECT id, title, body FROM " . $SQLTable['content'] . $where . " AND flags='" . $sub . "' ORDER BY displayorder"; $data['data'] = $sqls; $data['buttons'] = 15; $data['sort'] = $sub; echo drawList($data, $first); $first = false; $all_subs[] = $sub; } } else { } $num_results_subs = countQuery("SELECT id FROM " . $SQLTable['content'] . $where . " AND flags IN ('" . implode("','", $all_subs) . "')"); if ($num_results_subs < $GLOBALS['num_results']) { // now draw all entries without matching sub $data2 = $data; $data2['tablehead'] = array('Keiner Kategorie zugeordnet', 'Text'); $data2['data'] = "SELECT id, title, body FROM " . $SQLTable['content'] . $where . " AND flags NOT IN ('" . implode("','", $all_subs) . "') ORDER BY displayorder"; $data2['sort'] = 'all'; echo drawList($data2, false); }