当前位置: 首页>>代码示例>>PHP>>正文


PHP sql_fetch_assoc函数代码示例

本文整理汇总了PHP中sql_fetch_assoc函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_fetch_assoc函数的具体用法?PHP sql_fetch_assoc怎么用?PHP sql_fetch_assoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sql_fetch_assoc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAttrbutesListArrayInternal

 public static function getAttrbutesListArrayInternal($cacheId, $bOnlySelectable, $firstLetterUppercase)
 {
     global $opt;
     $attributes = array();
     $rsAttrGroup = sql("SELECT `attribute_groups`.`id`,\n\t\t             IFNULL(`tt1`.`text`, `attribute_groups`.`name`) AS `name`,\n\t\t             IFNULL(`tt2`.`text`, `attribute_categories`.`name`) AS `category`,\n\t\t             `attribute_categories`.`color`\n\t\t\tFROM `attribute_groups`\n\t\t\tINNER JOIN `attribute_categories` \n\t\t\t    ON `attribute_groups`.`category_id`=`attribute_categories`.`id`\n\t\t\tLEFT JOIN `sys_trans` AS `t1` \n\t\t\t    ON `attribute_groups`.`trans_id`=`t1`.`id` \n\t\t\t    AND `attribute_groups`.`name`=`t1`.`text`\n\t\t\tLEFT JOIN `sys_trans_text` AS `tt1` \n\t\t\t    ON `t1`.`id`=`tt1`.`trans_id` \n\t\t\t    AND `tt1`.`lang`='&1'\n\t\t\tLEFT JOIN `sys_trans` AS `t2` \n\t\t\t    ON `attribute_categories`.`trans_id`=`t2`.`id` \n\t\t\t    AND `attribute_categories`.`name`=`t2`.`text`\n\t\t\tLEFT JOIN `sys_trans_text` AS `tt2` \n\t\t\t    ON `t2`.`id`=`tt2`.`trans_id` \n\t\t\t    AND `tt2`.`lang`='&1'\n\t\t\tORDER BY `attribute_groups`.`id` ASC", $opt['template']['locale']);
     while ($rAttrGroup = sql_fetch_assoc($rsAttrGroup)) {
         $attr = array();
         $bFirst = true;
         $bSearchGroupDefault = false;
         if ($cacheId == 0) {
             $sAddWhereSql = '';
             if ($bOnlySelectable == true) {
                 $sAddWhereSql .= ' AND `cache_attrib`.`selectable`=1';
             }
             $rsAttr = sql("SELECT `cache_attrib`.`id`, \n                            IFNULL(`tt1`.`text`, `cache_attrib`.`name`) AS `name`,\n\t\t\t\t\t\t\tIFNULL(`tt2`.`text`, `cache_attrib`.`html_desc`) AS `html_desc`,\n\t\t\t\t\t\t\t`cache_attrib`.`icon`, `cache_attrib`.`search_default`\n\t\t\t\t\tFROM `cache_attrib`\n\t\t\t\t\tLEFT JOIN `sys_trans` AS `t1` \n\t\t\t\t\t    ON `cache_attrib`.`trans_id`=`t1`.`id` \n\t\t\t\t\t    AND `cache_attrib`.`name`=`t1`.`text`\n\t\t\t\t\tLEFT JOIN `sys_trans_text` AS `tt1` \n\t\t\t\t\t    ON `t1`.`id`=`tt1`.`trans_id` \n\t\t\t\t\t    AND `tt1`.`lang`='&1'\n\t\t\t\t\tLEFT JOIN `sys_trans` AS `t2` \n\t\t\t\t\t    ON `cache_attrib`.`html_desc_trans_id`=`t2`.`id`\n\t\t\t\t\tLEFT JOIN `sys_trans_text` AS `tt2` \n\t\t\t\t\t    ON `t2`.`id`=`tt2`.`trans_id` \n\t\t\t\t\t    AND `tt2`.`lang`='&1'\n\t\t\t\t\tWHERE `cache_attrib`.`group_id`='&2'" . $sAddWhereSql . "\n\t\t\t\t\tAND NOT IFNULL(`cache_attrib`.`hidden`, 0)=1\n\t\t\t\t\tORDER BY `cache_attrib`.`group_id` ASC", $opt['template']['locale'], $rAttrGroup['id']);
         } else {
             $rsAttr = sql("SELECT `cache_attrib`.`id`, \n                            IFNULL(`tt1`.`text`, `cache_attrib`.`name`) AS `name`,\n\t\t\t\t\t\t\tIFNULL(`tt2`.`text`, `cache_attrib`.`html_desc`) AS `html_desc`,\n\t\t\t\t\t\t\t`cache_attrib`.`icon`, `cache_attrib`.`search_default`\n\t\t\t\t\tFROM `caches_attributes`\n\t\t\t\t\tINNER JOIN `cache_attrib` \n\t\t\t\t\t    ON `caches_attributes`.`attrib_id`=`cache_attrib`.`id`\n\t\t\t\t\tLEFT JOIN `sys_trans` AS `t1` \n\t\t\t\t\t    ON `cache_attrib`.`trans_id`=`t1`.`id` \n\t\t\t\t\t    AND `cache_attrib`.`name`=`t1`.`text`\n\t\t\t\t\tLEFT JOIN `sys_trans_text` AS `tt1` \n\t\t\t\t\t    ON `t1`.`id`=`tt1`.`trans_id` \n\t\t\t\t\t    AND `tt1`.`lang`='&2'\n\t\t\t\t\tLEFT JOIN `sys_trans` AS `t2` \n\t\t\t\t\t    ON `cache_attrib`.`html_desc_trans_id`=`t2`.`id`\n\t\t\t\t\tLEFT JOIN `sys_trans_text` AS `tt2` \n\t\t\t\t\t    ON `t2`.`id`=`tt2`.`trans_id`\n\t\t\t\t\t    AND `tt2`.`lang`='&2'\n\t\t\t\t\tWHERE `caches_attributes`.`cache_id`='&1' \n\t\t\t\t\tAND `cache_attrib`.`group_id`='&3'\n\t\t\t\t\tAND NOT IFNULL(`cache_attrib`.`hidden`, 0)=1\n\t\t\t\t\tORDER BY `cache_attrib`.`group_id` ASC", $cacheId, $opt['template']['locale'], $rAttrGroup['id']);
         }
         while ($rAttr = sql_fetch_assoc($rsAttr)) {
             if ($firstLetterUppercase) {
                 $rAttr['name'] = mb_strtoupper(mb_substr($rAttr['name'], 0, 1)) . mb_substr($rAttr['name'], 1);
             }
             $attr[] = $rAttr;
             if ($rAttr['search_default']) {
                 $bSearchGroupDefault = true;
             }
         }
         sql_free_result($rsAttr);
         if (count($attr) > 0) {
             $attributes[] = array('id' => $rAttrGroup['id'], 'name' => $rAttrGroup['name'], 'color' => $rAttrGroup['color'], 'category' => $rAttrGroup['category'], 'search_default' => $bSearchGroupDefault, 'attr' => $attr);
         }
     }
     sql_free_result($rsAttrGroup);
     return $attributes;
 }
开发者ID:kirstenko,项目名称:oc-server3,代码行数:35,代码来源:attribute.class.php

示例2: cleanup_mapresult2

 function cleanup_mapresult2($slaveId)
 {
     global $opt;
     // cleanup old entries
     $rs = sql("SELECT SQL_BUFFER_RESULT `result_id` FROM `map2_result` WHERE DATE_ADD(`date_created`, INTERVAL '&1' SECOND)<NOW()", $opt['map']['maxcacheage']);
     while ($r = sql_fetch_assoc($rs)) {
         sql("DELETE FROM `map2_result` WHERE `result_id`='&1'", $r['result_id']);
     }
     sql_free_result($rs);
     // now reduce table size? (29 bytes is the average row size)
     if (sql_value_slave("SELECT COUNT(*) FROM `map2_data`", 0) > $opt['map']['maxcachesize'] / 29) {
         while (sql_value_slave("SELECT COUNT(*) FROM `map2_data`", 0) > $opt['map']['maxcachereducedsize'] / 29) {
             $resultId = sql_value("SELECT `result_id` FROM `map2_result` WHERE `slave_id`='&1' ORDER BY `date_lastqueried` DESC LIMIT 1", 0, $slaveId);
             if ($resultId == 0) {
                 return;
             }
             sql("DELETE FROM `map2_result` WHERE `result_id`='&1'", $resultId);
         }
     }
     $nMinId = sql_value("SELECT MIN(`result_id`) FROM `map2_result`", 0);
     if ($nMinId == 0) {
         sql("DELETE FROM `map2_data`");
     } else {
         sql("DELETE FROM `map2_data` WHERE `result_id`<'&1'", $nMinId);
     }
 }
开发者ID:RH-Code,项目名称:opencaching,代码行数:26,代码来源:slave_cleanup.class.php

示例3: run

 public function run()
 {
     $rsDuplicatePic = sql('SELECT `object_id`, `title`
          FROM `pictures`
          WHERE `object_type`=1
          GROUP BY `object_id`, `title`
          HAVING COUNT(*) > 1');
     while ($rDuplicatePic = sql_fetch_assoc($rsDuplicatePic)) {
         $rsInstances = sql(" SELECT `pictures`.`id` `picid`, `cache_logs`.`cache_id` `cache_id`\n                 FROM `pictures`\n                 LEFT JOIN `cache_logs` ON `cache_logs`.`id` = `pictures`.`object_id`\n                 WHERE `pictures`.`object_type`=1 AND `pictures`.`object_id`='&1' AND `pictures`.`title`='&2'\n                 ORDER BY `pictures`.`date_created`", $rDuplicatePic['object_id'], $rDuplicatePic['title']);
         $instances = sql_fetch_assoc_table($rsInstances);
         foreach ($instances as &$instance) {
             $instance['pic'] = new picture($instance['picid']);
             $instance['filesize'] = @filesize($instance['pic']->getFilename());
         }
         $countInstances = count($instances);
         for ($n = 1; $n < $countInstances; ++$n) {
             if ($instances[$n]['filesize'] !== false) {
                 // ensure that pic is stored locally
                 for ($nn = $n - 1; $nn >= 0; --$nn) {
                     if ($instances[$nn]['filesize'] === $instances[$n]['filesize']) {
                         if (file_get_contents($instances[$nn]['pic']->getFilename()) == file_get_contents($instances[$n]['pic']->getFilename())) {
                             $picture = $instances[$n]['pic'];
                             echo 'deleting duplicate picture ' . $picture->getPictureId() . ' ("' . $picture->getTitle() . '")' . ' from log ' . $rDuplicatePic['object_id'] . ' of cache ' . $instances[$n]['cache_id'] . "\n";
                             $picture->delete(false);
                             $instances[$n]['filesize'] = false;
                             break;
                         }
                     }
                 }
             }
         }
     }
     sql_free_result($rsDuplicatePic);
 }
开发者ID:kratenko,项目名称:oc-server3,代码行数:34,代码来源:picture_cleanup.class.php

示例4: run

 public function run()
 {
     $rsCache = sql("SELECT `cache_id`, `latitude`, `longitude` FROM `caches` WHERE `need_npa_recalc`=1");
     while ($rCache = sql_fetch_assoc($rsCache)) {
         sql("DELETE FROM `cache_npa_areas` WHERE `cache_id`='&1' AND `calculated`=1", $rCache['cache_id']);
         $rsLayers = sql("SELECT `id`, `type_id`, AsText(`shape`) AS `geometry` \n                FROM `npa_areas` WHERE `exclude`=0 AND MBRWITHIN(GeomFromText('&1'), `shape`)", 'POINT(' . $rCache['longitude'] . ' ' . $rCache['latitude'] . ')');
         while ($rLayers = sql_fetch_assoc($rsLayers)) {
             if (gis::ptInLineRing($rLayers['geometry'], 'POINT(' . $rCache['longitude'] . ' ' . $rCache['latitude'] . ')')) {
                 $bExclude = false;
                 // prüfen, ob in ausgesparter Fläche
                 $rsExclude = sql("SELECT `id`, AsText(`shape`) AS `geometry`\n                        FROM `npa_areas`\n                        WHERE `exclude` = 1\n                        AND `type_id`='&1'\n                        AND MBRWITHIN(GeomFromText('&2'), `shape`)", $rLayers['type_id'], 'POINT(' . $rCache['longitude'] . ' ' . $rCache['latitude'] . ')');
                 while (($rExclude = sql_fetch_assoc($rsExclude)) && $bExclude == false) {
                     if (gis::ptInLineRing($rExclude['geometry'], 'POINT(' . $rCache['longitude'] . ' ' . $rCache['latitude'] . ')')) {
                         $bExclude = true;
                     }
                 }
                 sql_free_result($rsExclude);
                 if ($bExclude == false) {
                     sql("INSERT INTO `cache_npa_areas` (`cache_id`, `npa_id`, `calculated`)\n                            VALUES ('&1', '&2', 1) ON DUPLICATE KEY UPDATE `calculated`=1", $rCache['cache_id'], $rLayers['id']);
                 }
             }
         }
         sql_free_result($rsLayers);
         sql("UPDATE `caches` SET `need_npa_recalc`=0 WHERE `cache_id`='&1'", $rCache['cache_id']);
     }
     sql_free_result($rsCache);
 }
开发者ID:kirstenko,项目名称:oc-server3,代码行数:27,代码来源:cache_npa_areas.class.php

示例5: getAttrbutesListArrayInternal

 static function getAttrbutesListArrayInternal($cacheId, $bOnlySelectable)
 {
     global $opt;
     $attributes = array();
     $rsAttrGroup = sql("SELECT `attribute_groups`.`id`, \r\n\t\t                           IFNULL(`tt1`.`text`, `attribute_groups`.`name`) AS `name`, \r\n\t\t                           IFNULL(`tt2`.`text`, `attribute_categories`.`name`) AS `category`, \r\n\t\t                           `attribute_categories`.`color`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `attribute_groups` \r\n\t\t\t\t\t\t\t\t\t\tINNER JOIN `attribute_categories` ON `attribute_groups`.`category_id`=`attribute_categories`.`id`\r\n\t\t\t\t\t\t\t\t\t\t LEFT JOIN `sys_trans` AS `t1` ON `attribute_groups`.`trans_id`=`t1`.`id` AND `attribute_groups`.`name`=`t1`.`text` \r\n\t\t\t\t\t\t\t\t\t\t LEFT JOIN `sys_trans_text` AS `tt1` ON `t1`.`id`=`tt1`.`trans_id` AND `tt1`.`lang`='&1' \r\n\t\t\t\t\t\t\t\t\t\t LEFT JOIN `sys_trans` AS `t2` ON `attribute_categories`.`trans_id`=`t2`.`id` AND `attribute_categories`.`name`=`t2`.`text` \r\n\t\t\t\t\t\t\t\t\t\t LEFT JOIN `sys_trans_text` AS `tt2` ON `t2`.`id`=`tt2`.`trans_id` AND `tt2`.`lang`='&1' \r\n\t\t\t\t\t\t\t\t\t\t\tORDER BY `attribute_groups`.`id` ASC", $opt['template']['locale']);
     while ($rAttrGroup = sql_fetch_assoc($rsAttrGroup)) {
         $attr = array();
         $bFirst = true;
         if ($cacheId == 0) {
             $sAddWhereSql = '';
             if ($bOnlySelectable == true) {
                 $sAddWhereSql = ' AND `cache_attrib`.`selectable`=1';
             }
             $rsAttr = sql("SELECT `cache_attrib`.`id`, IFNULL(`tt1`.`text`, `cache_attrib`.`name`) AS `name`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tIFNULL(`tt2`.`text`, `cache_attrib`.`html_desc`) AS `html_desc`, `cache_attrib`.`icon`\r\n\t\t\t\t\t\t\t\t\t\t\t\t FROM `cache_attrib`\r\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `sys_trans` AS `t1` ON `cache_attrib`.`trans_id`=`t1`.`id` AND `cache_attrib`.`name`=`t1`.`text` \r\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `sys_trans_text` AS `tt1` ON `t1`.`id`=`tt1`.`trans_id` AND `tt1`.`lang`='&1' \r\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `sys_trans` AS `t2` ON `cache_attrib`.`html_desc_trans_id`=`t2`.`id` \r\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `sys_trans_text` AS `tt2` ON `t2`.`id`=`tt2`.`trans_id` AND `tt2`.`lang`='&1' \r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE `cache_attrib`.`group_id`='&2'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND NOT IFNULL(`cache_attrib`.`hidden`, 0)=1\r\n\t\t\t\t\t\t\t\t\t\t ORDER BY `cache_attrib`.`group_id` ASC", $opt['template']['locale'], $rAttrGroup['id']);
         } else {
             $rsAttr = sql("SELECT `cache_attrib`.`id`, IFNULL(`tt1`.`text`, `cache_attrib`.`name`) AS `name`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tIFNULL(`tt2`.`text`, `cache_attrib`.`html_desc`) AS `html_desc`, `cache_attrib`.`icon`\r\n\t\t\t\t\t\t\t\t\t\t\t\t FROM `caches_attributes` \r\n\t\t\t\t\t\t\t\t\t INNER JOIN `cache_attrib` ON `caches_attributes`.`attrib_id`=`cache_attrib`.`id` \r\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `sys_trans` AS `t1` ON `cache_attrib`.`trans_id`=`t1`.`id` AND `cache_attrib`.`name`=`t1`.`text` \r\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `sys_trans_text` AS `tt1` ON `t1`.`id`=`tt1`.`trans_id` AND `tt1`.`lang`='&2' \r\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `sys_trans` AS `t2` ON `cache_attrib`.`html_desc_trans_id`=`t2`.`id` \r\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `sys_trans_text` AS `tt2` ON `t2`.`id`=`tt2`.`trans_id` AND `tt2`.`lang`='&2' \r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE `caches_attributes`.`cache_id`='&1' AND `cache_attrib`.`group_id`='&3'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND NOT IFNULL(`cache_attrib`.`hidden`, 0)=1\r\n\t\t\t\t\t\t\t\t\t\t ORDER BY `cache_attrib`.`group_id` ASC", $cacheId, $opt['template']['locale'], $rAttrGroup['id']);
         }
         while ($rAttr = sql_fetch_assoc($rsAttr)) {
             $attr[] = $rAttr;
         }
         sql_free_result($rsAttr);
         if (count($attr) > 0) {
             $attributes[] = array('name' => $rAttrGroup['name'], 'color' => $rAttrGroup['color'], 'category' => $rAttrGroup['category'], 'attr' => $attr);
         }
     }
     sql_free_result($rsAttrGroup);
     return $attributes;
 }
开发者ID:RH-Code,项目名称:opencaching,代码行数:28,代码来源:attribute.class.php

示例6: fill

 public function fill($max_inserts_count)
 {
     global $opt;
     $rowCount = 0;
     $nInsertCount = 0;
     if ($opt['logic']['waypoint_pool']['fill_gaps'] == true) {
         // query the first unused waypoint (between other waypoints)
         $rsStartWp = sql("SELECT SQL_BUFFER_RESULT DECTOWP(WPTODEC(`c`.`wp_oc`, '&1')+1, '&1') AS `free_wp`\n                               FROM `caches` AS `c`\n                          LEFT JOIN `caches` AS `cNext` ON DECTOWP(WPTODEC(`c`.`wp_oc`, '&1')+1, '&1')=`cNext`.`wp_oc`\n                          LEFT JOIN `cache_waypoint_pool` ON DECTOWP(WPTODEC(`c`.`wp_oc` ,'&1')+1, '&1')=`cache_waypoint_pool`.`wp_oc`\n                              WHERE `c`.`wp_oc` REGEXP '&2'\n                                AND ISNULL(`cNext`.`wp_oc`)\n                                AND ISNULL(`cache_waypoint_pool`.`wp_oc`)\n                           ORDER BY `free_wp` ASC\n                              LIMIT 250", $opt['logic']['waypoint_pool']['prefix'], '^' . $opt['logic']['waypoint_pool']['prefix'] . '[' . $opt['logic']['waypoint_pool']['valid_chars'] . ']{1,}$');
     } else {
         // query the last used waypoint
         $rsStartWp = sql("SELECT SQL_BUFFER_RESULT DECTOWP(MAX(dec_wp)+1, '&2') AS `free_wp`\n                           FROM (\n                                   SELECT MAX(WPTODEC(`wp_oc`, '&2')) AS dec_wp\n                                     FROM `caches`\n                                    WHERE `wp_oc` REGEXP '&1'\n                              UNION\n                                   SELECT MAX(WPTODEC(`wp_oc`, '&2')) AS dec_wp\n                                     FROM `cache_waypoint_pool`\n                                 ) AS tbl", '^' . $opt['logic']['waypoint_pool']['prefix'] . '[' . $opt['logic']['waypoint_pool']['valid_chars'] . ']{1,}$', $opt['logic']['waypoint_pool']['prefix']);
     }
     while (($rStartWp = sql_fetch_assoc($rsStartWp)) && $nInsertCount < $max_inserts_count) {
         $free_wp = $rStartWp['free_wp'];
         if ($free_wp == '') {
             $free_wp = $opt['logic']['waypoint_pool']['prefix'] . '0001';
         }
         $nInsertCount += $this->fill_turn($free_wp, $max_inserts_count - $nInsertCount);
         $rowCount++;
     }
     sql_free_result($rsStartWp);
     if ($rowCount == 0) {
         // new database ...
         $nInsertCount += $this->fill_turn($opt['logic']['waypoint_pool']['prefix'] . '0001', $max_inserts_count);
     }
     return $nInsertCount;
 }
开发者ID:kirstenko,项目名称:oc-server3,代码行数:27,代码来源:cache_waypoint_pool.class.php

示例7: assign_rs

 function assign_rs($name, $rs)
 {
     $items = array();
     while ($r = sql_fetch_assoc($rs)) {
         $items[] = $r;
     }
     $this->assign($name, $items);
 }
开发者ID:PaulinaKowalczuk,项目名称:oc-server3,代码行数:8,代码来源:mail.class.php

示例8: run

 function run()
 {
     global $opt;
     $rsCache = sql("SELECT `caches`.`cache_id`, `caches`.`latitude`, `caches`.`longitude` FROM `caches` LEFT JOIN `cache_location` ON `caches`.`cache_id`=`cache_location`.`cache_id` WHERE ISNULL(`cache_location`.`cache_id`) UNION SELECT `caches`.`cache_id`, `caches`.`latitude`, `caches`.`longitude` FROM `caches` INNER JOIN `cache_location` ON `caches`.`cache_id`=`cache_location`.`cache_id` WHERE `caches`.`last_modified`>`cache_location`.`last_modified`");
     while ($rCache = sql_fetch_assoc($rsCache)) {
         $sCode = '';
         $rsLayers = sql("SELECT `level`, `code`, AsText(`shape`) AS `geometry` FROM `nuts_layer` WHERE WITHIN(GeomFromText('&1'), `shape`) ORDER BY `level` DESC", 'POINT(' . $rCache['longitude'] . ' ' . $rCache['latitude'] . ')');
         while ($rLayers = sql_fetch_assoc($rsLayers)) {
             if (gis::ptInLineRing($rLayers['geometry'], 'POINT(' . $rCache['longitude'] . ' ' . $rCache['latitude'] . ')')) {
                 $sCode = $rLayers['code'];
                 break;
             }
         }
         sql_free_result($rsLayers);
         if ($sCode != '') {
             $adm1 = null;
             $code1 = null;
             $adm2 = null;
             $code2 = null;
             $adm3 = null;
             $code3 = null;
             $adm4 = null;
             $code4 = null;
             if (mb_strlen($sCode) > 5) {
                 $sCode = mb_substr($sCode, 0, 5);
             }
             if (mb_strlen($sCode) == 5) {
                 $code4 = $sCode;
                 $adm4 = sql_value("SELECT `name` FROM `nuts_codes` WHERE `code`='&1'", null, $sCode);
                 $sCode = mb_substr($sCode, 0, 4);
             }
             if (mb_strlen($sCode) == 4) {
                 $code3 = $sCode;
                 $adm3 = sql_value("SELECT `name` FROM `nuts_codes` WHERE `code`='&1'", null, $sCode);
                 $sCode = mb_substr($sCode, 0, 3);
             }
             if (mb_strlen($sCode) == 3) {
                 $code2 = $sCode;
                 $adm2 = sql_value("SELECT `name` FROM `nuts_codes` WHERE `code`='&1'", null, $sCode);
                 $sCode = mb_substr($sCode, 0, 2);
             }
             if (mb_strlen($sCode) == 2) {
                 $code1 = $sCode;
                 // try to get localised name first
                 $adm1 = sql_value("SELECT IFNULL(`sys_trans_text`.`text`, `countries`.`name`)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM `countries`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN `sys_trans` ON `countries`.`trans_id`=`sys_trans`.`id` AND `countries`.`name`=`sys_trans`.`text`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&2'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `countries`.`short`='&1'", null, $sCode, $opt['template']['default']['locale']);
                 if ($adm1 == null) {
                     $adm1 = sql_value("SELECT `name` FROM `nuts_codes` WHERE `code`='&1'", null, $sCode);
                 }
             }
             sql("INSERT INTO `cache_location` (`cache_id`, `adm1`, `adm2`, `adm3`, `adm4`, `code1`, `code2`, `code3`, `code4`) VALUES ('&1', '&2', '&3', '&4', '&5', '&6', '&7', '&8', '&9') ON DUPLICATE KEY UPDATE `adm1`='&2', `adm2`='&3', `adm3`='&4', `adm4`='&5', `code1`='&6', `code2`='&7', `code3`='&8', `code4`='&9'", $rCache['cache_id'], $adm1, $adm2, $adm3, $adm4, $code1, $code2, $code3, $code4);
         } else {
             $sCountry = sql_value("SELECT IFNULL(`sys_trans_text`.`text`, `countries`.`name`)\r\n\t\t\t\t                         FROM `caches` \r\n\t\t\t\t                   INNER JOIN `countries` ON `caches`.`country`=`countries`.`short`\r\n\t\t\t\t                    LEFT JOIN `sys_trans` ON `countries`.`trans_id`=`sys_trans`.`id` AND `countries`.`name`=`sys_trans`.`text`\r\n\t\t\t\t                    LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&2'\r\n\t\t\t\t                        WHERE `caches`.`cache_id`='&1'", null, $rCache['cache_id'], $opt['template']['default']['locale']);
             $sCode1 = sql_value("SELECT `caches`.`country` FROM `caches` WHERE `caches`.`cache_id`='&1'", null, $rCache['cache_id']);
             sql("INSERT INTO `cache_location` (`cache_id`, `adm1`, `code1`) VALUES ('&1', '&2', '&3') ON DUPLICATE KEY UPDATE `adm1`='&2', `adm2`=NULL, `adm3`=NULL, `adm4`=NULL, `code1`='&3', `code2`=NULL, `code3`=NULL, `code4`=NULL", $rCache['cache_id'], $sCountry, $sCode1);
         }
     }
     sql_free_result($rsCache);
 }
开发者ID:RH-Code,项目名称:opencaching,代码行数:58,代码来源:cache_location.class.php

示例9: geodb_setAllCacheLocations

function geodb_setAllCacheLocations()
{
    $rs = sqll("SELECT `caches`.`cache_id` FROM `caches` LEFT JOIN `cache_location` ON `caches`.`cache_id`=`cache_location`.`cache_id` WHERE ISNULL(`cache_location`.`cache_id`) OR `cache_location`.`last_modified`!=`caches`.`last_modified`");
    while ($r = sql_fetch_assoc($rs)) {
        geodb_setCacheLocation($r['cache_id']);
    }
    sql_free_result($rs);
    sqll("DELETE FROM `cache_location` WHERE `cache_id` NOT IN (SELECT `cache_id` FROM `caches`)");
}
开发者ID:RH-Code,项目名称:opencaching,代码行数:9,代码来源:geodb.inc.php

示例10: setAllCacheLocations

 public static function setAllCacheLocations()
 {
     $rs = sqll("SELECT `caches`.`cache_id`\n             FROM `caches`\n             LEFT JOIN `cache_location`\n                ON `caches`.`cache_id`=`cache_location`.`cache_id`\n             WHERE\n                ISNULL (`cache_location`.`cache_id`)\n                OR `cache_location`.`last_modified`!=`caches`.`last_modified`");
     while ($r = sql_fetch_assoc($rs)) {
         self::setCacheLocation($r['cache_id']);
     }
     sql_free_result($rs);
     sqll("\n            DELETE FROM `cache_location`\n            WHERE `cache_id` NOT IN (SELECT `cache_id` FROM `caches`)");
 }
开发者ID:kratenko,项目名称:oc-server3,代码行数:9,代码来源:geodb.class.php

示例11: getComment

 /**
  * Returns the requested comment
  *
  * @static
  */
 function getComment($commentid)
 {
     $query = 'SELECT `cnumber` AS commentid, `cbody` AS body, `cuser` AS user, `cmail` AS userid, `cemail` AS email, `cmember` AS memberid, `ctime`, `chost` AS host, `mname` AS member, `cip` AS ip, `cblog` AS blogid' . ' FROM ' . sql_table('comment') . ' LEFT OUTER JOIN ' . sql_table('member') . ' ON `cmember` = `mnumber`' . ' WHERE `cnumber` = ' . intval($commentid);
     $comments = sql_query($query);
     $aCommentInfo = sql_fetch_assoc($comments);
     if ($aCommentInfo) {
         $aCommentInfo['timestamp'] = strtotime($aCommentInfo['ctime']);
     }
     return $aCommentInfo;
 }
开发者ID:hatone,项目名称:Nucleus-v3.64,代码行数:15,代码来源:COMMENT.php

示例12: get_cache_size_from_database

function get_cache_size_from_database()
{
    global $dblink;
    $cache_size = array();
    $resp = sql("SELECT * FROM cache_size ORDER BY id ASC");
    while ($row = sql_fetch_assoc($resp)) {
        $cache_size[] = $row;
    }
    return $cache_size;
}
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:10,代码来源:caches.inc.php

示例13: getHistoryConference

 public function getHistoryConference()
 {
     $query = "SELECT id, idCal, idCourse, name, room_type, starttime, endtime, meetinghours, maxparticipants" . " FROM conference_room" . " WHERE idCourse IN(" . implode(',', $this->getUserCourse()) . ")" . " AND endtime < '" . fromDatetimeToTimestamp(date('Y-m-d H:i:s')) . "'" . " ORDER BY starttime, name";
     $result = sql_query($query);
     $res = array();
     while ($row = sql_fetch_assoc($result)) {
         $res[$row['id']] = $row;
     }
     return $res;
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:10,代码来源:VideoconferenceLms.php

示例14: CreateCacheFile

 function CreateCacheFile()
 {
     global $opt, $translate;
     $f = fopen($this->sMenuFilename, 'w');
     fwrite($f, "<?php\n");
     fwrite($f, 'global $menuitem;' . "\n");
     fwrite($f, "\n");
     $rsDefines = sqlf("SELECT `id`, `id_string` FROM `sys_menu`");
     while ($rDefine = sql_fetch_assoc($rsDefines)) {
         fwrite($f, 'if (!defined(\'' . addslashes($rDefine['id_string']) . '\')) define(\'' . addslashes($rDefine['id_string']) . '\', ' . $rDefine['id'] . ");\n");
     }
     sql_free_result($rsDefines);
     fwrite($f, "\n");
     $aMenu = array();
     $nPos = 0;
     $rsSubmenu = sqlf("SELECT `id` FROM `sys_menu` WHERE `parent`=0 ORDER BY `parent` ASC, `position` ASC");
     while ($rSubmenu = sql_fetch_assoc($rsSubmenu)) {
         $aMenu[MNU_ROOT]['subitems'][$nPos] = $rSubmenu['id'];
         $nPos++;
     }
     sql_free_result($rsSubmenu);
     fwrite($f, "\n");
     $rs = sqlf('SELECT `item`.`id`, `item`.`title`, `item`.`menustring`, `item`.`access`, `item`.`href`, `item`.`visible`, `item`.`parent` AS `parentid`, `item`.`color` AS `color` FROM `sys_menu` AS `item` LEFT JOIN `sys_menu` AS `parentitem` ON `item`.`parent`=`parentitem`.`id`');
     while ($r = sql_fetch_assoc($rs)) {
         $aMenu[$r['id']]['title'] = $translate->t($r['title'], '', basename(__FILE__), __LINE__);
         $aMenu[$r['id']]['menustring'] = $translate->t($r['menustring'], '', basename(__FILE__), __LINE__);
         $aMenu[$r['id']]['authlevel'] = $r['access'] == 0 ? AUTH_LEVEL_ALL : AUTH_LEVEL_ADMIN;
         if (substr($r['href'], 0, 1) == '!') {
             $aMenu[$r['id']]['href'] = substr($r['href'], 1);
             $aMenu[$r['id']]['target'] = 'target="_blank"';
         } else {
             $aMenu[$r['id']]['href'] = $r['href'];
             $aMenu[$r['id']]['target'] = '';
         }
         $aMenu[$r['id']]['visible'] = $r['visible'];
         $aMenu[$r['id']]['sublevel'] = $this->pGetMenuSublevel($r['id']);
         if ($r['parentid'] != 0) {
             $aMenu[$r['id']]['parent'] = $r['parentid'];
         }
         if ($r['color'] != null) {
             $aMenu[$r['id']]['color'] = $r['color'];
         }
         $nPos = 0;
         $rsSubmenu = sqlf("SELECT `id` FROM `sys_menu` WHERE `parent`='&1' ORDER BY `parent` ASC, `position` ASC", $r['id']);
         while ($rSubmenu = sql_fetch_assoc($rsSubmenu)) {
             $aMenu[$r['id']]['subitems'][$nPos] = $rSubmenu['id'];
             $nPos++;
         }
         sql_free_result($rsSubmenu);
     }
     sql_free_result($rs);
     fwrite($f, '$menuitem = unserialize("' . str_replace('"', '\\"', serialize($aMenu)) . '");' . "\n");
     fwrite($f, "?>");
     fclose($f);
 }
开发者ID:4Vs,项目名称:oc-server3,代码行数:55,代码来源:menu.class.php

示例15: ForumAdmin

function ForumAdmin()
{
    global $hlpfile, $NPDS_Prefix, $f_meta_nom, $f_titre, $adminimg;
    include "header.php";
    GraphicAdmin($hlpfile);
    adminhead($f_meta_nom, $f_titre, $adminimg);
    echo '
   <h3>' . adm_translate("Catégories de Forum") . '</h3>
   <table data-toggle="table" data-striped="true" data-search="true" data-show-toggle="true" data-mobile-responsive="true" data-icons="icons" data-icons-prefix="fa">
      <thead>
         <tr>
            <th data-sortable="true">' . adm_translate("Index") . '&nbsp;</th>
            <th data-sortable="true">' . adm_translate("Nom") . '&nbsp;</th>
            <th>' . adm_translate("Nombre de Forum(s)") . '&nbsp;</th>
            <th>' . adm_translate("Fonctions") . '&nbsp;</th>
         </tr>
      </thead>
      <tbody>';
    $result = sql_query("SELECT cat_id, cat_title FROM " . $NPDS_Prefix . "catagories ORDER BY cat_id");
    while (list($cat_id, $cat_title) = sql_fetch_row($result)) {
        $gets = sql_query("SELECT COUNT(*) AS total FROM " . $NPDS_Prefix . "forums WHERE cat_id='{$cat_id}'");
        $numbers = sql_fetch_assoc($gets);
        echo '
         <tr>
            <td align="left">' . $cat_id . '</td>
            <td align="left">' . StripSlashes($cat_title) . '</td>
            <td align="center">' . $numbers['total'] . ' <a href="admin.php?op=ForumGo&amp;cat_id=' . $cat_id . '"><i class="fa fa-eye fa-lg" title="' . adm_translate("Voir les forums de cette catégorie") . ': ' . StripSlashes($cat_title) . '." data-toggle="tooltip"></i></a></td>
            <td align="right"></a><a href="admin.php?op=ForumCatEdit&amp;cat_id=' . $cat_id . '"><i class="fa fa-edit fa-lg" title="' . adm_translate("Editer") . '" data-toggle="tooltip"></i></a> <a href="admin.php?op=ForumCatDel&amp;cat_id=' . $cat_id . '&amp;ok=0"><i class="fa fa-trash-o fa-lg text-danger" title="' . adm_translate("Effacer") . '" data-toggle="tooltip" ></i></a></td>
         </tr>';
    }
    echo '
       </tbody>
   </table>
   <h3>' . adm_translate("Ajouter une catégorie") . '</h3>
   <form action="admin.php" method="post">
      <div class="form-group">
         <div class="row">
            <label class="form-control-label col-sm-4 col-md-4" for="catagories">' . adm_translate("Nom") . '</label>
            <div class="col-sm-8">
               <textarea class="form-control" type="text" name="catagories" id="catagories" rows="3" required="required"></textarea>
            </div>
         </div>
      </div>
      <div class="form-group">
         <div class="row">
            <div class="col-sm-offset-4 col-sm-8">
               <input type="hidden" name="op" value="ForumCatAdd" />
               <button class="btn btn-primary col-xs-12" type="submit"><i class="fa fa-plus-square fa-lg"></i>&nbsp;' . adm_translate("Ajouter une catégorie") . '</button>
            </div>
         </div>
      </div>
   </form>';
    adminfoot('fv', '', '', '');
}
开发者ID:Jireck-npds,项目名称:npds_dune,代码行数:54,代码来源:phpbbforum.php


注:本文中的sql_fetch_assoc函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。