Query MySQL after user logsin
Author: David B.
Visited 3862,
Followers 1,
Shared 0
I have a page with a Database View. The MySQL table is displaying correctly.
The Database viewer is displaying all the rows in the table and it has 'Filter' and 'Export to CSV' buttons.
I also have a Login and Logout page on the site.
The page with the Database Viewer is a restricted page and requires a login before it can be viewed.
I want to be able to use the Login information to filter the data rows so that the LoggedIn user only sees the rows that are their information. The table has a unique primary key.
How can I show only the relevant rows in the database viewer?
Posted on the
Hello David
You cannot if you use the database viewer.
I have for a long time ago asked for this - latest in this post : https://helpcenter.websitex5.com/en/post/175265
You could support this post.
You could use a script or some free software to do the job.
Here on this testsite : http://www.energifremtiden.dk/c4d/
I use a member system for controlling members and download quotas.
For this I use the free member-system ADMIDIO : https://www.admidio.org/
For making it possible for the user to keep track of users specific downloaded for a period, I use the free
REPORTICO software : http://www.reportico.org/site/index.php
The report software is able to make advanced reports ( with joins and calculations ) and it is also possible to make the report tool use login information from the ADMIDIO system ( or another system ).
I have made a report where a user when logged into the member system, will see a list of his downloaded amount for a period - and at the bottom of the list is a total for the downloads in numbers and in MB.
You will see nothing as you are not able to log into the member-system.
I hope INCOMEDIA will make it possible to make at least a selection option ( for logged in user ) in the database-viewer.
They have made it for the orders - now they should make it for the viewer.
Kind regards
John S.
The search ( list of user downloads ) is here : http://www.energifremtiden.dk/c4d/search.html
It is possible, but you have to do the coding.
I have done this on my site. I use the whoIsLogged() function to get the name and email address and a linked file for connection to the database. I use the email address to filter the database and show their data on a personal info page and also allow them to update certain individual fields.
Of course the email must be unique, no more partners sharing an email address.
I did this because I got fed up waiting for them to develop an personal data object.
I thought I would try and create my own peronal optional object, but they decided to discontinue this option, even if it is for your own use.
See http://websitex5.readthedocs.io/en/latest/optional-objects/introduction/index.html
Author
Thanks Mark... I have decided to use AlphaSoftware(A5V12) for all database pages... I will continue to use WebSite X5 to create HTML pages but A5 is WAY more powerful for anything that requires a SQL or .dbf table.
https://www.alphasoftware.com/video-library