Ignore:
Timestamp:
2006/12/12 23:43:18 (20 years ago)
Author:
uehara
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • temp/test-xoops.ec-cube.net/html/modules/xoopspoll/class/xoopspolloption.php

    r739 r770  
    9898 
    9999    // public 
    100     function updateCount() 
     100    function updateCount($rating_id) 
    101101    { 
    102         $votes = XoopsPollLog::getTotalVotesByOptionId($this->getVar("option_id")); 
    103         $sql ="UPDATE ".$this->db->prefix("xoopspoll_option")." SET option_count=$votes WHERE option_id=".$this->getVar("option_id").""; 
     102        if($rating_id == 1) { 
     103            $colum = "option_count"; 
     104        } else { 
     105            $colum = "minus_count"; 
     106        } 
     107        $votes = XoopsPollLog::getTotalVotesByOptionId($this->getVar("option_id"), $rating_id); 
     108        $sql ="UPDATE ".$this->db->prefix("xoopspoll_option")." SET $colum=$votes WHERE option_id=".$this->getVar("option_id").""; 
     109 
    104110        $this->db->query($sql); 
    105111    } 
     
    124130        $db =& Database::getInstance(); 
    125131        $ret = array(); 
    126         $sql = "SELECT u.uid, u.uname, l.rating_id, l.comment FROM ".$db->prefix("xoopspoll_log")." l, ". $db->prefix("users") ." u WHERE l.user_id = u.uid AND l.option_id=".intval($option_id)." ORDER BY time DESC"; 
     132        $sql = "SELECT u.uid, u.uname, l.rating_id, l.comment FROM ".$db->prefix("xoopspoll_log")." l LEFT JOIN ". $db->prefix("users") ." u  ON l.user_id = u.uid WHERE l.option_id=".intval($option_id)." ORDER BY time DESC"; 
    127133        $result = $db->query($sql); 
    128134        while ( $myrow = $db->fetchArray($result) ) { 
Note: See TracChangeset for help on using the changeset viewer.