Example #1
0
 public function getGenreRssUrls($genre = "")
 {
     $db = new clsDB();
     //DBコネクション
     if ($db->connect() == -1) {
         $this->errormsg = $db->errormsg;
         return -1;
     }
     //取得SQL
     $sql = "select GENRE, SITE_NAME, SITE_URL from mst_rss ";
     if ($genre != "") {
         $sql .= " where GENRE = '" . $genre . "' ";
     }
     //SQL生成
     $db->setSQL($sql);
     //SQL実行
     if ($db->execute() == -1) {
         //dbクローズ
         $db->close();
         $this->errormsg = $db->errormsg;
         return -1;
     }
     //結果取得
     while ($db->fetch()) {
         //追加インデックスを取得
         if (!isset($this->rss_urls)) {
             $idx = 0;
         } else {
             $idx = count($this->rss_urls);
         }
         //リクエストURLの追加
         $this->rss_urls[$idx] = new urlRssapi();
         $this->rss_urls[$idx]->genre = $db->row('GENRE');
         $this->rss_urls[$idx]->site_name = $db->row('SITE_NAME');
         $this->rss_urls[$idx]->rss_url = $db->row('SITE_URL');
     }
     //dbクローズ
     $db->close();
     return 0;
 }