Php read 4 tables-VBForums
Results 1 to 5 of 5

Thread: Php read 4 tables

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    395

    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>

  2. #2
    PowerPoster
    Join Date
    May 2002
    Posts
    24,790

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    395

    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 08:08 AM.

  4. #4
    PowerPoster
    Join Date
    May 2002
    Posts
    24,790

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    395

    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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.