38 lines
2.0 KiB
PHP
38 lines
2.0 KiB
PHP
|
|
<?php header('Content-type: application/json');
|
||
|
|
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/include/analytics/');
|
||
|
|
include(PATHTOINCLUDES."base.php");
|
||
|
|
$em="";
|
||
|
|
|
||
|
|
|
||
|
|
$sql="SELECT
|
||
|
|
`ask_dr_bate`.`aid`,
|
||
|
|
`ask_dr_bate`.`thecontent`,
|
||
|
|
`ask_dr_bate`.`thetype`,
|
||
|
|
`ask_dr_bate`.`thelink`,
|
||
|
|
`ask_dr_bate`.`theimg`,
|
||
|
|
`ask_dr_bate`.`isactive`,
|
||
|
|
`ask_dr_bate`.`thedate`
|
||
|
|
FROM
|
||
|
|
`ask_dr_bate`
|
||
|
|
WHERE `ask_dr_bate`.`isactive` = 'Y'
|
||
|
|
ORDER BY `ask_dr_bate`.`aid` DESC
|
||
|
|
LIMIT 4";
|
||
|
|
$query=$database->database_query($sql) or $em .= $database->database_error();
|
||
|
|
$rownum=0;$imgnum=0;
|
||
|
|
$askdrbate="";
|
||
|
|
while ($row = $database->database_fetch_assoc($query)) {
|
||
|
|
$rownum=$rownum+1;
|
||
|
|
$imgnum=$imgnum+1;
|
||
|
|
if($rownum % 2 != 0){$rc="odd";} else{$rc="even";}
|
||
|
|
if($imgnum % 8 == 0){$imgnum=1;}
|
||
|
|
if($rc=="odd") {
|
||
|
|
$askdrbate .='<div class="bg-gray adb-item odd" id="ask_cw_'.$row["aid"].'"><div class="adb-yellow adb-content"><a href="javascript:get_page(\''.$row["thelink"].'\')"><img src="/include/analytics/images/dr_bate/dr_bate_'.$imgnum.'.jpg" alt="Ask Dr. Bate"></a><a class="adb-yellow" href="javascript:get_page(\''.$row["thelink"].'\')" id="thecontent_'.$row["aid"].'">'.stripslashes($row["thecontent"]).'</a><div class="adb-blog-type adb-green" id="thetype_'.$row["aid"].'">'.stripslashes($row["thetype"]).'</div><div class="pdp-clearfix"> </div></div></div>';
|
||
|
|
} else {
|
||
|
|
$askdrbate .='<div class="bg-black adb-item even" id="ask_cw_'.$row["aid"].'"><div class="adb-green adb-content"><a href="javascript:get_page(\''.$row["thelink"].'\')"><img src="/include/analytics/images/dr_bate/dr_bate_'.$imgnum.'.jpg" alt="Ask Dr. Bate"></a><a class="adb-green" href="javascript:get_page(\''.$row["thelink"].'\')" id="thecontent_'.$row["aid"].'">'.stripslashes($row["thecontent"]).'</a><div class="adb-blog-type adb-yellow" id="thetype_'.$row["aid"].'">'.stripslashes($row["thetype"]).'</div><div class="pdp-clearfix"> </div></div></div>';
|
||
|
|
}
|
||
|
|
}
|
||
|
|
$arr = array ('error'=>$em, 'adb'=>$askdrbate);
|
||
|
|
echo json_encode($arr);
|
||
|
|
?>
|
||
|
|
|