Forum Moderators: coopster

Message Too Old, No Replies

Can I Get PHP To Query From Multiple Tables?

         

deeanne59

5:19 pm on Jul 15, 2004 (gmt 0)

10+ Year Member



I will have several tables in my database, several of which will contain similar products. Is there a way to set up my pages where PHP will get the items I request from EACH table?

coopster

5:23 pm on Jul 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Sure, but the bigger question is why separate them? Why not store them all in one products table?

deeanne59

5:33 pm on Jul 15, 2004 (gmt 0)

10+ Year Member



I probably could. I thought it would be harder to combine, say, 40 datafeeds into one massive table. Plus, I was assuming that it would slow the search of said table. I know I would also have to rename feed headers and move columns around in each feed to match database columns. Is there an easier way? I would love to find one.

coopster

7:16 pm on Jul 17, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Slow the search? Not necessarily, considering you optimize your table (INDEX it properly, etc). Is there an easier way to what? Combine datafeeds? I'm not sure I follow here. I guess you you will either need to condition/prep your data on the front end, or resort to multiple tables and queries on the back end, either way it is going to take some prep work.

deeanne59

7:49 pm on Jul 17, 2004 (gmt 0)

10+ Year Member



My main concern is the column layout. Feed #1 is laid out: A,B,C,D,E...Feed#2 is laid out B,F,C,A,E....Feed#3 is laid out F,G,A,M,Z,B....I know I need to do some prep work, but the only way I can figure this out right now, is to open each feed and manually "move" each column to match the layout of my database. I wasn't sure if MySQL would upload the feeds in a different order, and then place them in the table correctly. That way I can do my other prep work, and not be as concerned with this problem.

coopster

8:38 pm on Jul 17, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Hmmm. What format are your feeds coming in? What about scripting the feed(s) using temporary tables? Then use an INSERT ... SELECT to populate the table?

deeanne59

10:59 pm on Jul 17, 2004 (gmt 0)

10+ Year Member



I have a couple of feeds in CSV format...most are in TXT files. I am new to PHP and MySQL...so I don't know how to script into a temporary table. I am having to download every feed to my computer, doctor them up, create my PHP pages...then view on my computer using EasyPHP. Then I would upload my .sql file of the database to my remote server. Not sure how all of this will work...but I WILL persevere.

I might try creating separate tables, then have my PHP pages pull from each table, depending on what the page is about. That way the table will be in the same layout as the feed. All advice is welcome.