This topic is locked

Show SQL results in Popup Dialog

4/6/2020 11:38:29 AM
PHPRunner General questions
A
AlphaBase author

I want to run the following SQl statement and display the results (Total_Owed ) in a dialog:

SELECT SUM(Cost) as Total_Owed FROM `Z_items`WHERE Paid_Date IS NULL



Can I run the statement and use the dialog api to show the results?

e.g. "Total owed is $123.45"

Sergey Kornilov admin 4/6/2020

Dialog API is designed to collect info from users. To display something you can use a simple alert() function:

https://developer.mozilla.org/en-US/docs/Web/API/Window/alert
So I would say you need to add a button, execute that SQL query in the Server event, pass results to ClientAfter event and display a message there using alert()

A
AlphaBase author 4/6/2020

Ok, thanks. It would be nice if PHPR provided a better dialog for that purpose. Alerts are kind of ugly.

Sergey Kornilov admin 4/6/2020

We'll add something at some point.
Meanwhile you can check something like this. Should not be very difficult to implement:

https://sweetalert2.github.io/

A
AlphaBase author 4/6/2020

Those are pretty amazing.