- Timestamp:
- 2006/12/12 23:43:18 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
temp/test-xoops.ec-cube.net/html/modules/xoopspoll/class/xoopspolloption.php
r739 r770 98 98 99 99 // public 100 function updateCount( )100 function updateCount($rating_id) 101 101 { 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 104 110 $this->db->query($sql); 105 111 } … … 124 130 $db =& Database::getInstance(); 125 131 $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 ANDl.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"; 127 133 $result = $db->query($sql); 128 134 while ( $myrow = $db->fetchArray($result) ) {
Note: See TracChangeset
for help on using the changeset viewer.
