•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 423,949 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,214 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 4515 | Replies: 4
![]() |
| |
•
•
Join Date: Feb 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Dear members, I am new for Php, wish to develope two dropdown list. One listing all DB's availabe with MySQL and on selection of one DB second should list tables in that DB ( with no 'GO' type button). Once Table selected third dropdown will list fileds availabe,
Can some one help me.
Thanks in advance.
Sunilpro
Can some one help me.
Thanks in advance.
Sunilpro
•
•
Join Date: Oct 2006
Location: Sofia, Bulgaria
Posts: 135
Reputation:
Rep Power: 2
Solved Threads: 7
•
•
•
•
Dear members, I am new for Php, wish to develope two dropdown list. One listing all DB's availabe with MySQL and on selection of one DB second should list tables in that DB ( with no 'GO' type button). Once Table selected third dropdown will list fileds availabe,
Can some one help me.
Thanks in advance.
Sunilpro
It can be done, however are you sure you want to be exposed like this. If you do this - it means you have hacked yourself and showed it to people.
Read carefully articles about security!
1. Access to all databases should have only root account! To make the thing you want you should log in from php as root! This is not secure at all!
2. If you want to make this, you should create a user granted view only. AND AVOID GIVING VIEW PERMISSIONS TO MYSQL_USER tables and DBS
3. The "no go" button change can be done with javascript, not with PHP. PHP can only insert the script where you need it. Look for onChange actions in some javascript reference.
If you still want to do this...well, we might guide you!
Good luck
•
•
Join Date: Feb 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Thanks a lot
I am writing a small offline apps to convert some data of multiple tables into one table with some middle processing and changes hence no problem of EXPOSURE so please guide me further.
Basically I am also new to JS Hence cannot undersatnd how to pass to and fro from PHP& JS.
Thanks for gre8 clue for onchange() event.
The specific prbolem with me is that I am stuck with >> How to choose SELECTED value (of listed database names) and pass on to the another dropdown which list the TABLES on SELECTED DB,
Thanks
Sunipro
I am writing a small offline apps to convert some data of multiple tables into one table with some middle processing and changes hence no problem of EXPOSURE so please guide me further.
Basically I am also new to JS Hence cannot undersatnd how to pass to and fro from PHP& JS.
Thanks for gre8 clue for onchange() event.
The specific prbolem with me is that I am stuck with >> How to choose SELECTED value (of listed database names) and pass on to the another dropdown which list the TABLES on SELECTED DB,
Thanks
Sunipro
•
•
Join Date: Oct 2006
Location: Sofia, Bulgaria
Posts: 135
Reputation:
Rep Power: 2
Solved Threads: 7
•
•
•
•
Thanks a lot![]()
I am writing a small offline apps to convert some data of multiple tables into one table with some middle processing and changes hence no problem of EXPOSURE so please guide me further.
Basically I am also new to JS Hence cannot undersatnd how to pass to and fro from PHP& JS.
Thanks for gre8 clue for onchange() event.
The specific prbolem with me is that I am stuck with >> How to choose SELECTED value (of listed database names) and pass on to the another dropdown which list the TABLES on SELECTED DB,
Thanks
Sunipro
Ok, if you're new both to PHP and MySQL, it is a good thing to start from the reference manuals of both PHP and MySQL. If you are new to html a good way to start is for example W3Schools.com. I will outline how it is made, still you have to figure it out.
1. in order to access the DB with full privilege you should login as root. This means that PHP should post to MySQL root as user and rootpass as password to have all privileges.
2. If connection is successful, your mysql querry should be smth like this
[php]$query = mysql_query('show databases;');[/php]
This will show all databases available on the server.
3. The results you should load in a <SELECT> element as <OPTION>s. This is done using some loop as foreach, while or for...depends on your choice.
Note in order to submit the form without GO button, you should make it like this
[html]<SELECT name="dbselec" onchange="document.form.submit()">[/html]
For each option you should insert a value like this:
e.g. you have loaded your results from the querry into $result wich holds the databases.Option should look like this
[php]echo '<option value="'.$result.'">'.result.'</option>';[/php]
4. When selected, the value will be submitted to next php script, wich will make another query using one of the following methods.
A. [php]$selectDB=mysql_select_db($option.value.from.previous.page);[/php]
B. [php]$query=mysql_query('show tables;');[/php]
OR
[php]$query = mysql_query('show tables from '.$option.value.from.previous.page.';');[/php]
5. Load the results the same way you loaded the result from the first query.
6. Now, I don't get it clear - if you want to view the table content or view the table structure.
A to view the table structure folow the above instructions to make the query, however the query should be like this:
[php]$query=mysql_query('describe table.'$table_name_from_previoust_page'.;');[/php]
OR
B. To view all records, your query should be:
[php]$query = mysql_query('SELECT * FROM'.$table_name_from_previous_page.';');[/php]
That's all. You should learn yourself how to display the results on your page. If I give you the complete script as it should look like, you'll never learn a thing, so forgive me not giving you all ready-made.

Good luck with learning!
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- How can I send variables from a PHP script to another URL using POST without......... (PHP)
- How many clients can access a PHP script at a time? (PHP)
- how to find stock information with php script (PHP)
- need help with PHP Script translation (PHP)
Other Threads in the PHP Forum
- Previous Thread: Black Response
- Next Thread: Help with comments box and uploading and resizing images for users


Hybrid Mode