Topic: Show MySQL query with button (Read 2842 times)
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« on: Aug 24, 2006, 10:35:46 am »
Hi All
I have several tables in MySQL that I would like to generate a query view of those records, one table at a time, within a formatted HTML table on the same page, but I would want this to happen when the end user clicks on a button. I would also like a "Clear" button to clear that query from the screen.
Any suggestions or examples?
Thanks gman
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #1 on: Aug 24, 2006, 10:39:52 am »
You mean you want to see the data stored in the table, like phpMyAdmin does?
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #2 on: Aug 24, 2006, 10:48:16 am »
Yes, but through a query that can be seen on the same page, and than a simple clear function to make the query disappear. Can this be done...I know the query part can be but not sure how to invoke it using a "Sumbit" like button
Thanks Nikolas
gman
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #3 on: Aug 24, 2006, 10:49:53 am »
You can use a <select> form and when you have a value to the post variable do the query that it sais
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #6 on: Aug 24, 2006, 11:21:40 am »
Thanks Nikolas, I will give that a shot...I appreciate it
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #7 on: Aug 24, 2006, 01:50:09 pm »
Alright...I got the code to work that queries the table data and formats it into a HTML table....came out alright...and I also setup the button to call that PHP code.
The issue is that the query is coming up in a separate window and I would like the data to appear below the button, on the same page.
I was looking at named anchors and not sure if that is the correct approach
Any thoughts?
Thanks
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #8 on: Aug 24, 2006, 02:07:08 pm »
You can do it in the same page, by using the same page for the form and the php code that parses the queries.
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #9 on: Aug 24, 2006, 02:21:08 pm »
Thanks Nikolas...just not sure how to do that. When I load the query php page, it automatically shows the data...I only want it to show when I click on the button
Here is the code that I used to show the data in the table...it is called from another page, but like I said, I would like the button on the page as well and this data to appear below the button
show_data.php
Code:
<?php
// This code will draw a table with the data retrieved from the query.
// Use the function written above... writeResult($result);
?>
So what I would like is the only thing on the page is the button when loading the page. When they click the button, the query data in the table appears on the same page below the button....hope this helps
Thank you gman
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #17 on: Aug 24, 2006, 03:57:59 pm »
Thanks guys, all errors are gone but where should I put the DB Connect function? This is actually part of Olaf's Access Class and I have including the access_user_class.php file
It is stating I do not have access to the server.
Thanks again
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
Thanks guys, all errors are gone but where should I put the DB Connect function? This is actually part of Olaf's Access Class and I have including the access_user_class.php file
It is stating I do not have access to the server.
Thanks again
is this file using the class?
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #19 on: Aug 24, 2006, 04:15:27 pm »
Well...I am trying to use the class...just not how to incorporate the code that Nikolas helped me out with and your code. Sorry for all of the questions...I appreciate the help
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3797