$sql_sl_post = "select p.sale_id,p.sale_title,p.sale_type,p.sale_price,p.sale_level,p.sale_readcount,p.sale_dateedit,p.sale_date,count(DISTINCT c.com_id) as comment,i.picpost_path from buysale as p LEFT JOIN comment as c ON p.sale_id = c.sale_id LEFT JOIN picpost as i ON p.sale_id = i.sale_id where $word $type $category $subcategory $state $price $level group by p.sale_id order by p.sale_date DESC LIMIT $goto,$pagelen"; //ทำการแสดงผลโดยใช้คำสั่ง Limit เพื่อแสดงจำนวนข้อมูลต่อหน้า
$qr_sl_post = mysql_db_query($dbname,$sql_sl_post);
$totalCurrecords= mysql_num_rows($qr_sl_post);
ผมเพิ่ม
$sql_sl_post = "select c.com_id,c.com_date,p.sale_id,p.sale_title,p.sale_type,p.sale_price,p.sale_level,p.sale_readcount,p.sale_dateedit,p.sale_date,count(DISTINCT c.com_id) as comment,i.picpost_path from buysale as p LEFT JOIN comment as c ON p.sale_id = c.sale_id LEFT JOIN picpost as i ON p.sale_id = i.sale_id where $word $type $category $subcategory $state $price $level group by p.sale_id order by p.sale_date DESC,c.com_date DESC LIMIT $goto,$pagelen";
$qr_sl_post = mysql_db_query($dbname,$sql_sl_post);
$totalCurrecords= mysql_num_rows($qr_sl_post);
group by p.sale_id order by p.sale_date DESC,c.com_date DESC LIMIT
$sql_sl_post = "select c.com_id,c.com_date,p.sale_id,p.sale_title,p.sale_type,p.sale_price,p.sale_level,p.sale_readcount,p.sale_dateedit,p.sale_date,count(DISTINCT c.com_id) as comment,i.picpost_path from buysale as p LEFT JOIN comment as c ON p.sale_id = c.sale_id LEFT JOIN picpost as i ON p.sale_id = i.sale_id where $word $type $category $subcategory $state $price $level group by p.sale_id order by c.com_date DESC,p.sale_date DESC LIMIT $goto,$pagelen";