PHP OOP class Sensative To Counter field name !
Posted
by Mac Taylor
on Stack Overflow
See other posts from Stack Overflow
or by Mac Taylor
Published on 2010-05-30T14:50:16Z
Indexed on
2010/05/30
14:52 UTC
Read the original article
Hit count: 164
hey guys
recently i managed to write a class for my stories , and everything is fine , unless counter field that stores page's hits
here is my class :
class nk_posts
{
var $data = array();
public function _data() {
global $db;
$result = $db->sql_query("
SELECT bt_stories.*,
bt_tags.*,
bt_topics.*,
group_concat(DISTINCT bt_tags.tag ) as mytags,
group_concat(DISTINCT bt_topics.topicname ) as mytopics
FROM bt_stories,bt_tags,bt_topics
WHERE
CONCAT( ' ', bt_stories.tags, ' ' )
LIKE CONCAT( '%', bt_tags.tid, '%' )
AND
CONCAT( ' ', bt_stories.associated, ' ' )
LIKE CONCAT( '%', bt_topics.topicid, '%' )
AND
time<=now() AND section='news' AND approved='1'
GROUP BY bt_stories.sid
ORDER BY bt_stories.sid DESC
");
while ($this->data = $db->sql_fetchrow($result)) {
$this->sid = $this->data['sid'];
$this->title = $this->data['title'];
$this->counter = $this->data['counter'];
//------Rest of Fields ------
$this->_output();
}
}
public function _output() {
themeindex(
$this->sid,
$this->title,
$this->counter,
//------Rest of Fields ------
);
}
}
problem
this class can't show counter filed value , but if i change counter field name to other thing like hit , .. everything goes fine
im sure its okay if i write it in normal php mysql way , but i need this to be in OOP way
any comment why it's sensitive to counter field name ?!
© Stack Overflow or respective owner