';
$data .= '';
$counter = 1;
while($row = mysql_fetch_object($result)){
$counter_str = '';
if($counter < 10) {
$counter_str = ' '.$counter.'. ';
}elseif($counter < 100) {
$counter_str = ' '.$counter.'. ';
}else {
$counter_str = $counter.'. ';
}
$data .= '';
$counter++;
}
$data .= '';
$data .= ' Download Book';
echo $data;
exit;
}elseif(isset($_POST['bid'])) {
$query = "select id, name, number from textbook_companion_chapter where cloud_chapter_err_status=0 and preference_id=".$_POST['bid']." order by number ASC";
$result = mysql_query($query);
$data = '';
$data .= ' Download Chapter';
echo json_encode($data);
exit;
}elseif(isset($_POST['cid'])) {
$query = "select id, caption, number from textbook_companion_example where cloud_err_status=0 and chapter_id=".$_POST['cid'];
$result = mysql_query($query);
$data = '';
$data .= ' Download Example';
echo json_encode($data);
exit;
}
?>