database_query($sql) or $em=$em.$database->database_error(); $thecount=0; $sql2="SELECT count(`mms_comments`.`mmsid`) AS cuid FROM `mms_comments` WHERE `mms_comments`.`vid` = ".$thevid.""; $rcount=$database->database_query($sql2); $thecount = $database->database_result($rcount,0); $database->database_free_result($rcount); $thecomments=""; $rownum=0; while ($row = $database->database_fetch_assoc($result)) { $rownum=$rownum+1; $blocklist = explode(",", $row["user_blocklist"]); $user_key = array_search($theuid, $blocklist); if($user_key!==true){ $number = (((int)($row['userid']/1000))*1000)+1000; if($row['user_photo']=="") { $uimage="/images/nophoto.png"; } else { $uimage="/uploads_user/".$number."/".$row['userid']."/".$row['user_photo']; $thepath = pathinfo($uimage); $uimage_thumb="/uploads_user/".$number."/".$row['userid']."/".$thepath['filename']."_thumb.".$thepath['extension']; $uimage_thumb_file=$_SERVER["DOCUMENT_ROOT"]. "/uploads_user/".$number."/".$row['userid']."/".$thepath['filename']."_thumb.".$thepath['extension']; if (file_exists($uimage_thumb_file)) {$uimage=$uimage_thumb;} else {} } $thecomments=$thecomments.'
'; }//exclude blocklist } $morebutton="off"; if($thecount-$offset > $limit) { //need more button -- must pass offset to js and update $morebutton="on"; //$offset=$offset + $limit; $limit=$limit+$limit; } $arr = array ('error' => $em, 'thecount'=>$thecount, 'thecomments'=>$thecomments, 'theoffset'=>$offset, 'thelimit'=>$limit,'more'=>$morebutton); echo json_encode($arr); ?>