-
Dec 30th, 2013, 07:45 AM
#1
Thread Starter
Fanatic Member
Php read 4 tables
Hello , how to make a sql query to display information for all characters
The characters are in 4 tables
CharInfo_1
CharInfo_2
CharInfo_3
CharInfo_4
what has inside them:
name,[Level],class,str,dex,CON,Intell,WIS,Gold,IP,Nationality
i want to read all the informations from this tables and to display the Name heroes in 1 column
Code:
<tr>
<td align='center' class='asd'>Name</td>
<td align='center' class='asd'><font color='red'>Level</font></td>
<td align='center' class='asd'><font color='green'>Class</font></td>
<td align='center' class='asd'><font color='yellow'>Race</font></td>
</tr>
<td align='center' class='maintable'><a onClick=\"showrankings('$rank')\">$row[0]</a></td>
<td align='center' class='maintable'>$row[1]</td>
<td align='center' class='maintable'>$row[2]</td>
<td align='center' class='maintable'>$row[10]</td>
-
Dec 30th, 2013, 08:49 AM
#2
Re: Php read 4 tables
are all four tables exactly the same?
if all 4 are exactly the same then this should work:
Code:
select name, level, class, race from CharInfo_1
union
select name, level, class, race from CharInfo_2
union
select name, level, class, race from CharInfo_3
union
select name, level, class, race from CharInfo_4
But... then I have to ask... if they are all the same, why are they in different tables?
-tg
-
Dec 30th, 2013, 09:02 AM
#3
Thread Starter
Fanatic Member
Re: Php read 4 tables
because GameServer is old version and there the creators of the game make it on 4 tables, on GameServer 2 has only 1 table
yes the tables are 1:1
and if i want to Update this tables how can i use it?
Last edited by diablo21; Dec 30th, 2013 at 09:08 AM.
-
Dec 30th, 2013, 09:18 AM
#4
Re: Php read 4 tables
at that point, you need to know which table the information came from... in those cases, I'll sometimes add a column to the query called "SRC" that denotes the source of the data:
Code:
select 1 as SRC, name, level, class, race from CharInfo_1
union
select 2 as SRC, name, level, class, race from CharInfo_2
union
select 3 as SRC, name, level, class, race from CharInfo_3
union
select 4 as SRC, name, level, class, race from CharInfo_4
Then when you need to update, check the value of SRC... if it's 1, then update CharInfo_1... and so on.
-tg
-
Dec 30th, 2013, 09:28 AM
#5
Thread Starter
Fanatic Member
Re: Php read 4 tables
okey if the tables are like this CharInfo_
when i write Select * CharInfo only displays all tables information wow no need to play so much with codes why?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|