require_once('common.inc.php');
$sql_publisher = "SELECT * FROM `publication` where `display` = '1' AND `id` = '".$id."' LIMIT 0,1";
$row_publisher=$db->getrow($sql_publisher);
$sql_new_book = "SELECT * FROM `node` where `status` = '1' AND `type` = 'book' AND `publisher` = '".$row_publisher['id']."' ORDER BY `publishing_date` DESC LIMIT 0,2";
$rs_new_book = $db->query($sql_new_book);
$new_book_list = '';
$price = '';
$img = '';
while($row_new_book=$db->fetch_array($rs_new_book)){
$price = str_replace('$','',$row_new_book['price']);
$photo = get_attachment("node",$row_new_book['id'],"cover");
if(file_exists("./".$photo["path"].'original/'.$photo["file_name"])){
$img = '';
} else {
if($row_new_book['cover']!=0&&$row_new_book['cover']!='')
{
$sql_cover = "SELECT * FROM `file_managed` WHERE `fid` = '".$row_new_book['cover']."' AND `status` = '1' LIMIT 0,1";
$row_cover = $db->getrow($sql_cover);
if($row_cover['filename']!=''){
if( file_exists('./upload/products/original/'.$row_cover['filename'])){
$img = '
';
} else {
$img = '
';
}
} else {
$img = '
';
}
} else
{
$img = '
';
}
}
$new_book_list .= '
| '.$img.' |
'.$row_new_book['title'].'
'.$row_new_book['author'].'
'.$row_publisher['name'].'
HK$ '.$price.' | '.$row_new_book['isbn'].' | '.$row_new_book['publishing_date'].'
|


