ShopMAster Posted September 22, 2008 Share Posted September 22, 2008 Ok, I have a script that I need some assistance with. I have two databases and there is a field in both that should have the same info. In the first database I have a table called a02_match_stats and there is a player_name field that should match another field (ps3persona) in another table (users) which is in another database. How do I use the script below to call the username (in the users table) instead of player_name. Example. Database 1 --> table (a02_match_stats) --> field (player_name) = MWShop Database 2 --> table (users) ----> field (ps3persona) = MWShop ---> field (username) = Shopmaster I want to replace the player_name with username. Hope I didn't lose anyone. <?PHP $tko=mysql_query("SELECT * FROM a02_match_stats ORDER by id DESC"); $conki=0; while ($kt=mysql_fetch_array($tko) AND $conki<10) { $conki++; $tt=mysql_fetch_array($tko); echo '<tr bgcolor="#FFFFFF"><td><a href="history.php?id='.$kt[id_player].'">'.$kt[player_name].'</a></td> <td>'.$kt[sBT].'</td><td>vs.</td><td><a href="history.php?id='.$tt[id_player].'">'.$tt[player_name].'</a></td><td>'.$tt[sBT].'</td></tr>'; } /*echo '<tr><td>player1</td> <td>(score)</td><td>vs.</td><td>player2</td><td>(score)</td></tr>'; echo '<tr bgcolor="#FFFFFF"><td>player1</td> <td>(score)</td><td>vs.</td><td>player2</td><td>(score)</td></tr>'; echo '<tr><td>player1</td> <td>(score)</td><td>vs.</td><td>player2</td><td>(score)</td></tr>'; echo '<tr bgcolor="#FFFFFF"><td>player1</td> <td>(score)</td><td>vs.</td><td>player2</td><td>(score)</td></tr>'; echo '<tr><td>player1</td> <td>(score)</td><td>vs.</td><td>player2</td><td>(score)</td></tr>'; echo '<tr bgcolor="#FFFFFF"><td>player1</td> <td>(score)</td><td>vs.</td><td>player2</td><td>(score)</td></tr>'; echo '<tr><td>player1</td> <td>(score)</td><td>vs.</td><td>player2</td><td>(score)</td></tr>'; echo '<tr bgcolor="#FFFFFF"><td>player1</td> <td>(score)</td><td>vs.</td><td>player2</td><td>(score)</td></tr>';*/ ?> Thanks for the help. Shop Quote Link to comment Share on other sites More sharing options...
ShopMAster Posted September 23, 2008 Author Share Posted September 23, 2008 help please... Quote Link to comment Share on other sites More sharing options...
jonsjava Posted September 23, 2008 Share Posted September 23, 2008 Pleasantly vague. OK. In order to help, I'm going to need more info. How are you getting the username to query the db? Is it being posted, or is it a search? Are you wanting this script to grab EVERY user, or just one? That will determine the solution to your problem. Both are doable, but each is done differently. Quote Link to comment Share on other sites More sharing options...
ShopMAster Posted September 24, 2008 Author Share Posted September 24, 2008 That's the thing I don't know how to get the username by querying the db. I'm already querying one database to pull in all the information on the following page. If you go here: http://www.mymaddenpad.com/?L=stats.ps3stats You'll see stats and in the top right hand you'll see the latest matches. FratGQ 20 vs. MWShop 14 FratGQ and MWShop are gamertags, not users on the site. Shopmaster's gamertag is MWShop and is defined in the users table in the ps3persona field on a different database than where this data is being pulled from. 1. How do I select the other database? 2. How do I select the username (Shopmaster) from a different database and display it instead of MWShop. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.