Here is the query which gets data from two tables in server side.php
SELECT SQL_CALC_FOUND_ROWS u.user_id,u.user_name,u.user_image,u.email,p.id,
p.image,p.description,p.comments,p.stock,p.timestamp,p.link,p.store,p.buy
FROM users u
INNER JOIN product p
ON u.user_id=p.user_id
$sWhere
$sOrder
$sLimit
";
DataTables with VERY Large Data Sets and get data from multiple tables?
-
09-10-2022 - |
문제
I am using the datatables server-side processing: http://datatables.net/release-datatables/examples/data_sources/server_side.html. But how can i get data from two tables?
해결책
다른 팁
Do it in this part of the example code:
$sQuery = "
SELECT SQL_CALC_FOUND_ROWS `".str_replace(" , ", " ", implode("`, `", $aColumns))."
FROM $sTable
LEFT JOIN secondTable ON secondTable.id = ".$table.".id
$sWhere
$sOrder
$sLimit
";
Beware that the additional fields should have respective cells in your html and the proper names in your columndefs.
Take @Vegetas advice for real. This is very basic PHP and SQL Stuff.
제휴하지 않습니다 StackOverflow