Page 1 of 1
Search 2 MySQL Table with PHP?
Posted: Thu Jun 28, 2007 7:56 pm
by influenceuk
Hi guys,
I have searched all over the place for help with this one.
I am after a script that will allow users to search my site but with a slight twist.
I have 2 tables, each with similar results.
example:
PS3 NTSC
MotorStorm
PS3 PAL
MotorStorm
What i am after is some way to search one of the tables so the user can select either PS3 NTSC or PS3 PAL then it would display the results the user is after.
Any one have any ideas?
Thanks in Advance.
Posted: Thu Jun 28, 2007 7:58 pm
by feyd
Can you explain the table layout more?
Posted: Thu Jun 28, 2007 8:09 pm
by influenceuk
Ok both table will be the same, however on will hold PAL titles, the other would hold NTSC.
basically it would look like this...
Title | Release Date | Price |
That im after is on the search box, to have a drop down selection for PS3 NTSC, and PS3 PAL.
then depending on which of the PS3 options the user choses it would then search the correct table.
Is that ok? or would you like more, its hard to expalin

Posted: Thu Jun 28, 2007 8:14 pm
by influenceuk
i found this...
http://php.about.com/od/phpwithmysql/ss ... arch_2.htm
which shows the idea of the search bit, however i need it to search 2 tables rather than some coloums. lol just to be awkward!
Posted: Thu Jun 28, 2007 8:16 pm
by feyd
Why not have one table that has a field allowing the selection of NTSC/PAL? An SET field would support this, for example, allowing you to choose either or both.
Posted: Thu Jun 28, 2007 8:21 pm
by influenceuk
that is true, i will look into it. its just i was after keeping the 2 formats seperate as its easier to maintain and update lol
let me know if you can work any thing out if not i will rewrite me tables

Posted: Thu Jun 28, 2007 8:38 pm
by feyd
The problem is there's a great deal of duplication in having two tables like this.
Generally if I were setting up such a database I would design it where there were probably three tables (with additional linking tables, potentially.) One for the main entry associated with the game; one for secondary titles (i.e. the game goes under a different title in X region, but it's still the same game.) and finally one for platform, media-format, signal-format and price.
The main entry wouldn't hold much of anything, it may in fact be a linking table in fashion. The platform (XBX, X360, PS3, PS2, PS1, PSP, AGB, NGC, etc), media-format (DVD, CD, Cart, UMD, whatever) and signal-format (NTSC, PAL, SECAM, Mesa-SECAM, etc) columns of the third table would likely be SETs.