public function CreateDB( $sort = "", $order = "", $query = "" ){
global $db, $id;
$this->NewsID = $id;
if( !$sort ) $sort = PREFIX."_banki_comments.id";
$sort = "ORDER BY {$sort} ";
if( empty( $query ) )
{
$query = "SELECT ".PREFIX."_banki_comments.id, banki_id, del, author_id, answer, author, text, otziv, name_otziv, tit_otziv, ip, date, approve=1, ".PREFIX."_banki_comments.email as com_email, ".USERPREFIX."_users.email, news_num, comm_num, user_group, reg_date, signature, foto, fullname, land, xfields, name FROM ".PREFIX."_banki_comments LEFT JOIN ".USERPREFIX."_users ON ".PREFIX."_banki_comments.author_id=".USERPREFIX."_users.user_id WHERE ".PREFIX."_banki_comments.banki_id = '{$this->NewsID}' {$sort} {$order}";
}
$result = $db->query( $query );
if( $db->num_rows( $result ) > 0 )
{
while( $row = $db->get_row( $result ) )
{
$this->IdAnswer[ $row['id'] ] = $row['answer'];
if( $row['answer'] ) $this->AnswerId[ $row['answer'] ][] = $row['id'];
$this->Row[ $row['id'] ] = $row;
if( !$row['answer'] ) $this->CountCom++;
}
return true;
}
return false;
}
Есть таблица - approve где 1 это показывать комментарий, а 0 соответственно нет.
Как сделать проверку? т.е. чтобы комменты выводились только с approve=1