Hi Abu, I have a query as such that I want to display in different parts of the page and not in the grid, is this possible:
SELECT
Count(L.id) AS Leads,
Sum(L.Cost) AS `Lead Cost`,
Sum(L.broker_fee) AS `Broker Fees`,
Sum(L.legal_fees) AS `Other Fees`,
Sum(L.comms) AS Commissions
FROM
tbl_lead L
INNER JOIN tbl_clients C ON L.client_id = C.client_id
WHERE
Year(L.LeadDate) = 2017
For example I could take the value of 'Leads', 'Lead Cost' etc and output into different divs withion the page the page?
You can run it as independent query and echo the results where you want.
// assuming $g = new jqgrid();
$sql = "SELECT
Count(L.id) AS Leads,
Sum(L.Cost) AS `Lead Cost`,
Sum(L.broker_fee) AS `Broker Fees`,
Sum(L.legal_fees) AS `Other Fees`,
Sum(L.comms) AS Commissions
FROM
tbl_lead L
INNER JOIN tbl_clients C ON L.client_id = C.client_id
WHERE
Year(L.LeadDate) = 2017";
$rs = $g->get_one($sql);
echo $rs["Leads"];
echo $rs["Lead Cost"];
Please email me complete code for review.
This code does not explain much about error.
Hi Abu, not sure why but this suddenly broke and now doesn't work! To test again I used your demo 'alternate row' I added the following:
$sql = "SELECT i.id, invdate , c.name, i.note, i.total As total, i.closed
FROM invheader i INNER JOIN clients c ON c.client_id = i.client_id";
$rs = $g->get_one($sql);
<body>
<?php echo $rs["total"];?>
</body>
It throws an error which I think is caused by it not knowing where the query is now its been changed from $g->select_command = to $sql = – Couldn't execute query. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') pg_tmp' at line 1 – SELECT count(*) as c FROM () pg_tmp