"Sajid" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > HI, > > I have a problem. > > I dont know how to create tables for this in PHPMYADMIN, the situation is > like this: > > I have to display lot of items on the screen. > > There are three Datagrids on the screen (I am using Flash for this so if i > get the database structure right, i will be able to take care of the rest of > the scripting to returning data from database.). > > Lets say the three DataGrids are called: > > DG1, DG2 and DG3 > > DG1 displays the list of CONTINENTS like (Norht America, Asia, South > America, Australia etc.) > > If you click any region in DG1, DG2 gets populated with list of countries > (like USA, Canada, Mexico... etc.) > > At the same time, when i have clicked a CONTINENT in DG1, an image of the > CONTINENT is displayed on the screen. > > Now, If i click on any Country in DG2, DG3 is getting populated with a ist > of Clubs (like Club1, Club2, Club3 etc.) > > At the same time, An image of the country and a description of the country > are displayed on the screen. > > again, if i click on any CLUB, it displays a Image, description and URL of > the CLUB. > > I dont know what the DATABASE STRUCTURE shold look like for this. I know > there has to be some kind of LINKING between the tables but i dont know > HOW..... :( > > I have been trying few things but without any success :( > > ------------------------------------------------------- > The DG1 field will be: > Continent_Name | Continent_Image | Continent_Text > > The DG2 fields will be: > Country_Name | Country_Image | Country_Text > > The DG3 fields will be: > Club_Name | Club_Image | Club_Text | Club_Url > ------------------------------------------------------- > > Can anyone show me the Sql for such a table structure?
Hi Sajid It seems like the Country in some manner has to be a undercategory for the continent, and the club a undercategory for the Country. A way you could do this, is to set up the tables like this: DG1: Continent_Id | Continent_Name | Continent_Image | Continent_Text DG2: Country_Id | Continent_Id | Country_Name | Country_Image | Country_Text DG3: Club_Id | Country_Id | Club_Name | Club_Image | Club_Text | Club_Url The id fields should be datatype INT, name and Url something like varchar(100), the text tinytext, and the images BLOB. What you could do is when the user first comes you run this query: "SELECT Continent_Id, Continent_Name FROM DG1". If you want to grab the text too you could just add Continent_Text in the query. To get the image, I would recommend some kind of file that gets the Content_Id and, gets the image, and prints it out. Now, when you display all of your continents(up to you), you should make them a link to the same file, but now giving a Continent_Id to the the file. Now, let's simulate someone clicked Europa, and that has a Continent_Id of 4. Then we go to the following file: foo.php?op=continent&id=4. Here we can run this query: "SELECT Continent_Name, Country_Id, Country_Name FROM DG2 WHERE Continent_Id = {$_GET['id']}". What we simply get here, is all the countries that are in the continent Europa, with the id 4 in DG1. Now we get the list, and you display that too. What you can do now, is too display links to the next step: showing the clubs. Let's say we want to take a look at France, and that country has 9 as a Country_Id. Now let's say we're at the following file: foo.php?op=clubs&id=9 Now we can run the following query: "SELECT Club_Id, Club_Name, Club_Url FROM DG3 WHERE Country_Id = {$_GET['id']}". Here we get all the clubs in France. I hope this was something helpful. Would be glad too demonstrate how to get the Country name and the Continent name while showing the club, but i think you're albe to sort this out now! Eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php