IT.COM

Php and phpmyadmin and a database full of tables

Spaceship Spaceship
Watch
Impact
20
hey people

anyone use phpmyadmin?

u see on the left frame once you selected a database it shows links to the tables


how would i selelect them

i looked at the phpmyadmin code and its all confusing


cheers
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
You can click on the table you want to work with, then up at the top you should see some links like:

[ Browse ] [ Select ] [ Insert ] [ Empty ] [ Drop ]

You can then select the field you want to work with and click one of them links and go from there to insert data, select data, etc..

Optionally you can run queries directly by typing them in the text area where it says:

Run SQL query/queries on database DbName :

For example, if you have a table named friends and type the following in the text area:

select * from friends;

It will select everything from that table and present it in a nicely formatted table for you. :)
 
0
•••
ahhhhhh sorry you have mis understood me


i want to create my own version (or at leaslest select the tables and then add them to a drop down box)

i know how to use phpmy admin


i just dont know how to select the names of the tables from a database in php
 
0
•••
ive sussed it now cheers :)

PHP:
<?

echo "<select name='adasd'>";
$dbname="contentsystem";
$result = mysql_list_tables($dbname);
while($row = mysql_fetch_row($result)){
echo"<option value='$row[0]<br>n'>$row[0]<br>n";
    }
mysql_free_result($result);
echo "</select>";
?>

this will display the tables that are in a database
 
0
•••
Originally posted by adam_uk
ahhhhhh sorry you have mis understood me
I don't think I misunderstood you, but rather you didn't ask your question very well. You can't just expect someone to read your mind. It's really a waste of time for others to help you when you ask questions that really say nothing about what you're actually wanting to do and they try to help you out and you come back with what you should have said in the first place. If you read your original question I think you'll see that I did in fact answer exactly what you asked. You need to put a little thought and effort into your questions. :)
Originally posted by adam_uk
i want to create my own version (or at leaslest select the tables and then add them to a drop down box)

i know how to use phpmy admin


i just dont know how to select the names of the tables from a database in php
And you see with a little thought and effort on your part you could have came up with that in the first place.

I believe I have told you this before and I'm not saying you do this intentionally or anything, but I think you should be aware of it because you do it often and I think it will help you and others that may be trying to help. :)

By the way, here's my version:
PHP:
echo "<select name=tables size=1>n";

    $result = mysql_query("SHOW tables");
    while($row = mysql_fetch_row($result)){
        print "<option>$row[0]n";
  }
echo "</select>n";
:beer:
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back