Jump to content

Need some help ... pulling info


ShopMAster

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/125328-need-some-help-pulling-info/
Share on other sites

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.

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.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.