I have a question for this, maybe I am doing the wrong way as I have created a two different search function which they have own different function search as one is SKU and one is Date
I have created a code for MySQL and Workbench and it working fine as I'm using
SELECT
settlement_id, sku
FROM
settlements
WHERE
sku LIKE 'ISCE%'
AND settlement_id LIKE '7072432852'
GROUP BY sku
HAVING sku IS NOT NULL AND LENGTH(sku) > 0
ORDER BY sku
and it displayed fine
I use this same function for the PHP pages
$output = '';
if (isset($_POST["query"])) {
$search = mysqli_real_escape_string($conn, $_POST["query"]);
$queryskulist = "
SELECT
settlement_id,
sku,
FROM settlements
WHERE sku LIKE '%" . $search . "%' and settlement_id LIKE '%" . $search . "%'
GROUP BY sku
HAVING sku IS NOT NULL AND LENGTH(sku) > 0
ORDER BY sku
";
} else {
$queryskulist = "
SELECT
settlement_id,
sku,
FROM settlements
GROUP BY sku
HAVING sku IS NOT NULL AND LENGTH(sku) > 0
ORDER BY sku ";
}
as you can see
WHERE sku LIKE '%" . $search . "%' and settlement_id LIKE '%" . $search . "%'
that's where I am getting an error as I am able to get data from only one function like this
WHERE sku LIKE '%" . $search . "%'
but I am unable to get two different search result, should I use two different query $_POST["query"]?
Any advice would be great, or Sample/Example demo PHP site would be great, it would help me a big picture on it.


SELECT settlement_id, sku .... GROUP BY skuis a invalid use of GROUP BY read psce.com/en/blog/2012/05/15/…