| Support Center

(Back to Website)

Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Out results to dashbaord

GARY BRETT Dec 12, 2017 04:57PM PKT

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?

Up 0 rated Down
Abu Ghufran Dec 12, 2017 07:16PM PKT PHP Grid - Support Center Engineer
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"];
Up 0 rated Down
GARY BRETT Dec 12, 2017 09:30PM PKT
Fantastic, works prefectly thanks so much
Up 0 rated Down
Gary Brett Jan 10, 2018 03:52PM PKT
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
Up 0 rated Down
Abu Ghufran Jan 13, 2018 09:28AM PKT PHP Grid - Support Center Engineer
Please email me complete code for review.
This code does not explain much about error.

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)

Contact Us

  • Post a Public Question
  • Email Us
  • Live Chat!
  • Ask the Community

    Instructions

    • Paste complete code that is involved in your question. You can use pastebin.com to share code link.

    Screenshots or Online link of webpage is helpful in resolution. You can also send email at address mentioned below.

    • To report an issue, Write steps to regenerate the case.

    • For email support or live chat, Use gridphp@gmail.com and add it in Google Chat.
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete