I use PHP MySQL select data like this with no error.
$sql = "SELECT pd_id, pd_name, pd_price, pd_qty
FROM tbl_product ORDER BY pd_id DESC";
I want to select only 6 row. So, I edit code like this.
$sql = "SELECT pd_id, pd_name, pd_price, pd_qty
FROM tbl_product ORDER BY pd_id DESC LIMIT 6";
Then , It show error like this.
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 0, 6' at line 2
How to select data 6 row from MySQL
Try this one
$sql = "SELECT pd_id, pd_name, pd_price, pd_qty
FROM tbl_product ORDER BY pd_id DESC LIMIT 0, 6 ";
SELECT TYPE FROM stuff ORDER BY STUFF_ID DESC LIMIT 6
用上面使用的列替换查询
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.