本文整理汇总了PHP中Mysql::fetcharray方法的典型用法代码示例。如果您正苦于以下问题:PHP Mysql::fetcharray方法的具体用法?PHP Mysql::fetcharray怎么用?PHP Mysql::fetcharray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mysql
的用法示例。
在下文中一共展示了Mysql::fetcharray方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _view
/**
* Zeigt die Einträge an
*
* @param int $max_entries_pp Anzahl Einträge pro Seite
*/
private function _view($max_entries_pp)
{
//Daten definiere und initialisieren
$this->_tplfile = 'news.tpl';
$news_array = array();
//Seite herausfinden
if (isset($this->_gpc['GET']['page']) && is_numeric($this->_gpc['GET']['page']) && $this->_gpc['GET']['page'] > 0) {
$page = $this->_gpc['GET']['page'];
} else {
$page = 1;
}
//Daten holen
$news_array = $this->_msbox->getEntries($max_entries_pp, $page, 'DESC', 'ASC', $this->_timeformat);
$this->_mysql->query('SELECT COUNT(*) as many FROM `news` WHERE `news_ref_ID` = \'0\'');
$entries = $this->_mysql->fetcharray('num');
$pagesnav_array = Page::get_static_pagesnav_array($entries[0], $max_entries_pp, $this->_gpc['GET']);
$this->_smarty->assign('entrys', $entries[0]);
foreach ($news_array as $key => $value) {
//Nur news-Daten ohne $news_array['many'] abchecken
$news_array[$key]['news_content'] = $this->_smilie->show_smilie(nl2br(htmlentities($value['news_content'])), $this->_mysql);
foreach ($value['comments'] as $ckey => $cvalue) {
$news_array[$key]['comments'][$ckey]['news_content'] = $this->_smilie->show_smilie(nl2br(htmlentities($cvalue['news_content'])), $this->_mysql);
}
}
$this->_smarty->assign('newsarray', $news_array);
$this->_smarty->assign('pages', $pagesnav_array);
}
示例2: _view
/**
* Zeigt die Einträge an
*
* @param int $max_entries_pp Anzahl Einträge pro Seite
*/
private function _view($max_entries_pp)
{
$this->_tplfile = 'gbook.tpl';
$gbook_array = array();
if (isset($this->_gpc['GET']['page']) && is_numeric($this->_gpc['GET']['page']) && $this->_gpc['GET']['page'] > 0) {
$page = $this->_gpc['GET']['page'];
} else {
$page = 1;
}
$gbook_array = $this->_msbox->getEntries($max_entries_pp, $page, 'DESC', 'ASC', $this->_timeformat);
$this->_mysql->query('SELECT COUNT(*) as many FROM `gbook` WHERE `gbook_ref_ID` = \'0\'');
$entries = $this->_mysql->fetcharray('num');
$this->_mysql->query('SELECT COUNT(*) as many FROM `gbook` WHERE `gbook_ref_ID` != \'0\'');
$comments = $this->_mysql->fetcharray('num');
$pagesnav_array = Page::get_static_pagesnav_array($entries[0], $max_entries_pp, $this->_gpc['GET']);
//Inhalt parsen (Smilies) und an Smarty-Array übergeben
foreach ($gbook_array as $key => $value) {
$gbook_array[$key] = array('ID' => $value['gbook_ID'], 'title' => htmlentities($value['gbook_title']), 'content' => $this->_smilie->show_smilie(htmlentities($value['gbook_content']), $this->_mysql), 'name' => htmlentities($value['gbook_name']), 'time' => $value['gbook_time'], 'email' => htmlentities($value['gbook_email']), 'hp' => htmlentities($value['gbook_hp']), 'number_of_comments' => $value['number_of_comments']);
$count = 0;
//Kommentare durchackern
foreach ($value['comments'] as $ckey => $cvalue) {
$gbook_array[$key]['comments'][$ckey] = array('ID' => $cvalue['gbook_ID'], 'title' => htmlentities($cvalue['gbook_title']), 'content' => $this->_smilie->show_smilie(htmlentities($cvalue['gbook_content']), $this->_mysql), 'name' => htmlentities($cvalue['gbook_name']), 'time' => $cvalue['gbook_time'], 'email' => htmlentities($cvalue['gbook_email']), 'hp' => htmlentities($cvalue['gbook_hp']));
$count++;
}
}
$this->_smarty->assign('gbook', $gbook_array);
$this->_smarty->assign('pages', $pagesnav_array);
$this->_smarty->assign('entries', $entries[0]);
$this->_smarty->assign('comments', $comments[0]);
}
示例3: _getRoot
/**
* Liefert der Path der Kategorien aus von der angegebenen Kategorie bis zur Hauptseite.
* Das zurückgelieferte Array sieht etwa folgendermassen aus:
* array(0 => Hauptseite, 1 => Kategorie 1, 2 => Kategorie 1.1, 3 => ...)
*
* @param int $cat_ID KategorieID der untersten Kategorie
* @param bool[optional] $inc_catID Gibt an, ob die Kategorie mit ID = $cat_ID auch in der Wurzel vorkommen soll
* @param bool[optional] $inc_hs Gibt an, ob der Eintrag 'Hauptseite' auch in der Wurzel vorkommen soll
* @return array $root_array Path der Kategorien.
*/
private function _getRoot($cat_ID, $inc_catID = false, $inc_hs = true)
{
/* Wurzel auslesen */
$tmp_arr = array();
if ($inc_catID == false) {
$this->_mysql->query("SELECT `ref_ID` FROM `gallery_categories` WHERE `ID` = '{$cat_ID}' LIMIT 1");
$data = $this->_mysql->fetcharray('assoc');
$tmp_ID = $data['ref_ID'];
} else {
$tmp_ID = $cat_ID;
}
for ($i = 0; $tmp_ID != 0; $i++) {
$this->_mysql->query("SELECT `ID`,`ref_ID`,`name` FROM `gallery_categories` WHERE `ID` = '{$tmp_ID}' LIMIT 1");
$tmp_arr[$i] = $this->_mysql->fetcharray('assoc');
$tmp_ID = $tmp_arr[$i]['ref_ID'];
}
if ($inc_hs == true) {
/*Hauptseite noch einfügen*/
$this->_smarty->config_load('textes.de.conf', 'Gallery');
$gallery_textes = $this->_smarty->get_config_vars();
$tmp_arr[++$i] = array('ID' => '0', 'name' => $gallery_textes['mainsite']);
return array_reverse($tmp_arr);
} else {
return null;
}
}
示例4: _send_entryform
/**
* Sendet das Formular zum Eintragen der Nachricht. Je nach Parameter werden Standartwerte oder POST-Daten an
* das Formular weitergegeben.
*
* @param boolean $first_form
* @param string $error
*/
private function _send_entryform($first_form = true, $error = null)
{
$this->_tpl_file = "mailform.tpl";
/* Daten ermitteln */
if ($first_form == false) {
/* Daten aus Post-Array */
$data = array('entry_id' => $this->_gpc['POST']['entry_id'], 'entry_title' => $this->_gpc['POST']['title'], 'entry_content' => $this->_gpc['POST']['content'], 'entry_name' => $this->_gpc['POST']['name'], 'entry_email' => $this->_gpc['POST']['email'], 'sessioncode' => $this->_sessioncode);
} else {
/* Standard-Einträge */
$mail_vars = $this->_configvars['Mail'];
$data = array('entry_id' => $this->_gpc['GET']['entry_id'], 'entry_title' => $mail_vars['entry_title'], 'entry_content' => $mail_vars['entry_content'], 'entry_name' => $mail_vars['entry_name'], 'entry_email' => $mail_vars['entry_email'], 'sessioncode' => $this->_sessioncode);
}
/* Error-Einträge */
if (isset($error)) {
$data['dump_errors'] = true;
$data['error_title'] = $this->_configvars['Form_Error']['error_in_form'];
$data['error_contents'] = $error;
}
$hash = $this->_captcha->get_pic(4);
$data['captcha_img'] = $hash;
$this->_mysql->query("SELECT `{$this->mail_tbl['column_name']}` FROM `{$this->mail_tbl['table']}` WHERE `{$this->mail_tbl['column_ID']}` = '{$data['entry_id']}' LIMIT 1");
$member_array = $this->_mysql->fetcharray();
$data['reciver_name'] = $member_array[$this->mail_tbl['column_name']];
$this->_smarty->assign($data);
}
示例5: _view
/**
* Zeigt die Einträge an
*
* @param int $max_entries_pp Anzahl Einträge pro Seite
*/
private function _view($max_entries_pp)
{
//Datei definieren und initalisieren
$this->_tplfile = 'news.tpl';
$news_array = array();
//Seite herausfinden
if (isset($this->_gpc['GET']['page']) && is_numeric($this->_gpc['GET']['page']) && $this->_gpc['GET']['page'] > 0) {
$page = $this->_gpc['GET']['page'];
} else {
$page = 1;
}
//Daten hollen
$news_array = $this->_msbox->getEntries($max_entries_pp, $page, 'DESC', 'ASC', $this->_timeformat);
$this->_mysql->query('SELECT COUNT(*) as many FROM `news` WHERE `news_ref_ID` = \'0\'');
$entries = $this->_mysql->fetcharray('num');
$pagesnav_array = Page::get_static_pagesnav_array($entries[0], $max_entries_pp, $this->_gpc['GET']);
//Inhalt parsen (Smilies) und an Smarty-Array übergeben
foreach ($news_array as $key => $value) {
$news_array[$key] = array('ID' => $value['news_ID'], 'title' => htmlentities($value['news_title']), 'content' => $this->_smilie->show_smilie(nl2br(htmlentities($value['news_content'])), $this->_mysql), 'name' => htmlentities($value['news_name']), 'time' => $value['news_time'], 'email' => htmlentities($value['news_email']), 'hp' => htmlentities($value['news_hp']), 'number_of_comments' => $value['number_of_comments']);
$count = 0;
//Kommentare durchackern
foreach ($value['comments'] as $ckey => $cvalue) {
$news_array[$key]['comments'][$ckey] = array('ID' => $cvalue['news_ID'], 'title' => htmlentities($cvalue['news_title']), 'content' => $this->_smilie->show_smilie(nl2br(htmlentities($cvalue['news_content'])), $this->_mysql), 'name' => htmlentities($cvalue['news_name']), 'time' => $cvalue['news_time'], 'email' => htmlentities($cvalue['news_email']), 'hp' => htmlentities($cvalue['news_hp']));
$count++;
}
}
$this->_smarty->assign('news', $news_array);
$this->_smarty->assign('pages', $pagesnav_array);
$this->_smarty->assign('entries', $entries[0]);
}
示例6: _getMenues
/**
* Gibt die Navigation in Form eines Arrays zurück
*
* @return array Navigation
*/
private function _getMenues()
{
static $nav_arr = null;
/* Navigation nur Aufrufen, falls dies noch nicht getan wurde */
if (!is_array($nav_arr)) {
$nav_arr = array();
$topid_arr = array();
$page = new Page($this->_smarty, $this->_mysql);
$this->_mysql->query("SELECT `menu_topid`, COUNT(*) as 'count' FROM `menu` GROUP BY `menu_topid`");
$i = 0;
while (($data = $this->_mysql->fetcharray('assoc')) !== false) {
$topid_arr[$i] = (int) $data['menu_topid'];
$i++;
}
$page->let_build_menu_array($topid_arr, $nav_arr, false, true);
}
return $nav_arr;
}
示例7: _view
/**
* Zeigt die einzelnen Contents an.
*
* @param int $number Anzahl Einträge pro Seite
*/
private function _view($number = 20)
{
$this->_tplfile = 'module.tpl';
if ($this->_isformsend()) {
$this->_updmods();
}
$this->_mysql->query("SELECT COUNT(*) as 'count' FROM `modules`");
$count = $this->_mysql->fetcharray('assoc');
$count = $count['count'];
$page = Page::get_current_page($this->_gpc['GET']);
$pages_nav = Page::get_static_pagesnav_array($count, $number, $this->_gpc['GET']);
$start = ($page - 1) * $number;
$this->_mysql->query("SELECT `modules_ID`, `modules_name`, `modules_file`, `modules_template_support`, `modules_mail_support`, `modules_status` FROM `modules` LIMIT {$start}, {$number}");
$this->_mysql->saverecords('assoc');
$modules_data = $this->_mysql->get_records();
$this->_smarty->assign('modules', $modules_data);
$this->_smarty->assign('pages', $pages_nav);
$this->_smarty->assign('info', $this->_getinfo(true));
}
示例8: check4login
/**
* Ueberprueft ob sich jemand einloggt
*
* @param array $post_array $_POST-Daten
* @return boolean Antwort, ob sich jemand einloggt.
* @uses Mysql Für die Verbindung zur Mysql-DB
* @uses Smarty Als Template-System
*/
public function check4login(&$post_array)
{
//Login-Formular gesendet?
if (isset($post_array['login']) && $post_array['login'] == "Anmelden") {
$login_data = $this->_getlogindata($post_array);
if (is_array($login_data)) {
//Benutzername und Passwort ueberpruefen
$this->_mysql->query("SELECT `user_ID` FROM `admin_users` WHERE `user_name` = '{$login_data['name']}' LIMIT 1");
if (($data = $this->_mysql->fetcharray('assoc')) === false) {
$this->_smarty->assign('login_error', $this->_textes['failname']);
$this->_smarty->display('login.tpl');
} else {
$this->_mysql->query("SELECT `user_ID` FROM `admin_users` WHERE `user_name` = '{$login_data['name']}' AND `user_pw` = '{$login_data['password_encrypted']}' LIMIT 1");
$data = $this->_mysql->fetcharray();
if (is_numeric($data[0])) {
$this->_user_id = $data[0];
$this->_session->create_session($data[0]);
//Sektion der Sprachdatei weitergeben für die Texte im Template
$this->_smarty->assign('section', 'Login');
$this->_smarty->assign('forward_link', "?" . $this->_session->get_sessionstring());
$this->_smarty->display('forward.tpl');
$this->_smarty->display('forward.tpl');
} elseif ($data == false) {
$this->_smarty->assign('login_error', $this->_textes['failpw']);
$this->_smarty->display('login.tpl');
} else {
/* Query zwar richtig, aber user_ID ungültig */
$this->_smarty->assign('login_error', $this->_textes['userinvalid']);
$this->_smarty->display('login.tpl');
}
}
return true;
} else {
$this->_smarty->assign('login_error', $this->_textes['noentry']);
$this->_smarty->display('login.tpl');
return true;
}
} else {
return false;
}
}
示例9: _check_spec_action
/**
* Prüft auf spezielle Aktionen durch
*
*/
private function _check_spec_action()
{
$modulname = '';
if ($this->_is_admin == true) {
$menu_tbl = 'admin_menu';
$mod_tbl = 'admin_modules';
} else {
$menu_tbl = 'menu';
$mod_tbl = 'modules';
}
if (key_exists('mail', $this->_gpc['GET'])) {
$modulname = 'mailmodule';
} elseif (key_exists('image', $this->_gpc['GET'])) {
$modulname = 'image_send';
}
if ($modulname != '') {
$query = "SELECT `{$menu_tbl}`.`menu_ID` FROM `{$menu_tbl}`,`{$mod_tbl}` " . "WHERE `{$mod_tbl}`.`modules_name` = '{$modulname}' AND `{$mod_tbl}`.`modules_ID` = `{$menu_tbl}`.`menu_page` " . "AND `{$menu_tbl}`.`menu_pagetyp` = 'mod' LIMIT 1";
$this->_mysql->query($query);
$data = $this->_mysql->fetcharray('num');
$this->_smarty_array['local_link'] = $this->_nav_id = (int) $data[0];
}
}
示例10: _initThumb
/**
* Initialisiert den Thumb
*
*/
private function _initThumb($thumb)
{
//Eintrag zur ID vorhanden?
$this->_mysql->query("SELECT `filename` FROM `bilder` WHERE `bilder_ID` = '{$thumb}' LIMIT 1");
$mysql_data = $this->_mysql->fetcharray();
//Ueberpruefung, ob ein Eintrag vorhanden ist
if (empty($mysql_data)) {
//Fehlerbild ausgeben, weil kein Eintrag vorhanden ist
$this->_initErrImg(100, 80, $this->_img_textes['no_id']);
return;
}
//Existiert kein Thumb, wird eins erstellt
if (!is_file(THUMB_DIR . $mysql_data['filename'])) {
$orgImg = new Image(IMAGE_DIR_ORIGN . $mysql_data['filename']);
$bild_data = $orgImg->send_infos();
$newSize = $this->_calcSize($bild_data['width'], $bild_data['height'], THUMB_MAXWIDTH, THUMB_MAXHEIGHT);
$orgImg->copy($newSize['width'], $newSize['height'], THUMB_DIR . $mysql_data['filename'], "jpeg");
unset($orgImg);
}
//Bild ausgeben
$this->_img = new Image(THUMB_DIR . $mysql_data['filename']);
$this->_img->send_image();
}
示例11: show_smilie
/**
* Erstellt via RegEx die Smilies im Text und gibt sie retour.
*
* Grober Ablauf (zur Nachkontrolle):
* 1. Auslesen der Smilies aus der Tabelle
* 2. Ueberpruefen ob das Smilie ueberhaupt noch existiert (is_file), wenn nicht, auslassen
* 3. RegEx der Texte
* 4. Rueckgabe des Textes.
*
* @param string $text Der zu parsende Text
* @param Mysql $mysql_link Verbindung zur DB
* @return string
* @uses Mysql
*/
public function show_smilie($text, $mysql_link)
{
$query = "SELECT * FROM smilies ORDER BY smilies_sign";
$mysql_link->query($query);
$return_text = $text;
while ($smilies_data = $mysql_link->fetcharray()) {
if (is_file($this->dir_smilies . $smilies_data["smilies_file"])) {
$return_text = str_replace($smilies_data["smilies_sign"], '<img src="' . $this->dir_smilies . $smilies_data["smilies_file"] . '" alt="' . $smilies_data["smilies_file"] . '"></img>', $return_text);
}
}
return $return_text;
}
示例12: _getMenues
/**
* Gibt die Navigation in Form eines Arrays zurück
*
* @param int $start Start
* @param int $number Anzahl
* @param boolean $unit_topid untergeordnete Menus eines Topid-Menus (topid = 0) nicht trennen
* @return array Navigation
*/
private function _getMenues($start = null, $number = null, $unit_topid = true)
{
static $nav_arr = null;
static $count_nav = null;
/* Navigation nur Aufrufen, falls dies noch nicht getan wurde */
if (!is_array($nav_arr)) {
$nav_arr = array();
$topid_arr = array();
$page = new Page($this->_smarty, $this->_mysql);
$this->_mysql->query("SELECT `menu_topid`, COUNT(*) as 'count' FROM `menu` GROUP BY `menu_topid`");
$i = 0;
while (($data = $this->_mysql->fetcharray('assoc')) !== false) {
$topid_arr[$i] = (int) $data['menu_topid'];
$i++;
}
$page->let_build_menu_array($topid_arr, $nav_arr, false, true, true, array('menu_position', 'menu_pagetyp', 'menu_display'));
$count_nav['all'] = count($nav_arr);
$count_nav['top'] = array();
$i = 0;
$count_nav['top'][0] = 0;
foreach ($nav_arr as $value) {
if ($value['menu_topid'] == 0) {
//$i = $value['menu_ID'];
$i++;
$count_nav['top'][$i] = 1;
} else {
$count_nav['top'][$i]++;
}
}
}
/* Hier wird nun der Bereich ausgewertet, welcher Teil des Menus zurückgegeben werden soll */
if (isset($start)) {
/* ist $unit_tropid true, wird eine topid = 0 und die darunterliegenden Menupunkte NICHT
* getrennt, auch wenn die Anzahl der Menupunkte grösser ist als $number
* Hat z.B. news (topid = 0) 10 darunterliegende Menupunkte, aber $number ist 7, wird news nicht
* aufgeteilt, sondern als Einheit bewahrt. */
if ($unit_topid == true) {
$start = (int) $start;
$count_start = 0;
/*$i ist das Startelement von $nav_arr*/
/* Die Anzahl Menupunkte für ein Topid (topid-menupunkt und darunterliegende)
* sind in $count_nav['top'] aufgelistet. In dieser Schleife werden nun die
* Anzahl Menupunkte zusammengezählt (speichern in $count_start), bis $start
* erreicht wird. Ist $count_start nun grösser als $start, spielt das insofern
* keine Rolle, weil die Topids zusammengehalten werden. */
for ($i = 0; $count_start < $start && $i < count($count_nav['top']); $i++) {
$count_start += $count_nav['top'][$i];
}
if (isset($number)) {
$number = (int) $number;
$count_number = 0;
/* Selbes Vorgehen wie bei der vorherigen For-Schleife */
for ($j = $i; $count_number < $count_start + $number && $j < count($count_nav['top']); $j++) {
$count_number += $count_nav['top'][$j];
}
return array_slice($nav_arr, $count_start, $count_number);
} else {
return array_slice($nav_arr, $count_start);
}
} else {
/* Topids werde nicht zusammengehalten => einfaches Aufsplitten der Menues */
if (isset($number)) {
return array_slice($nav_arr, $start, $number);
} else {
return array_slice($nav_arr, $start);
}
}
}
/* Ohne Angabe von $start wird die gesammte Navigation zurückgegeben */
return $nav_arr;
}