Hi,
I've got a query that works fine, but would like to take it a step further and I've had no luck so far.
The query is:
--------------------------------------------------------
$result = mysql_query("SELECT playerid,race,xp FROM `table` WHERE playerid = 'STEAM_X:X:XXXXXX'");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf("PlayerID: %s || Race: %s || XP: %s<br>", $row[0], $row[1], $row[2]);
}
--------------------------------------------------------
This outputs the following:
PlayerID: STEAM_X:X:XXXXXX || Race: 1 || XP: 5000000
PlayerID: STEAM_X:X:XXXXXX || Race: 2 || XP: 5000000
PlayerID: STEAM_X:X:XXXXXX || Race: 3 || XP: 5000000
Is there anyway to make it so that if the race outputs "1", it's turned into "Hello" for example? So it would look like:
PlayerID: STEAM_X:X:XXXXXX || Race: Hello || XP: 5000000
I've tried meddling with IF statements (if (race == 1) echo('Blah Blah'); if (race == 2) echo('Blah Blah #2'); for example).
Any ideas? Sorry if this is somewhat confusing, hope you can understand it though
Cheers.
I've got a query that works fine, but would like to take it a step further and I've had no luck so far.
The query is:
--------------------------------------------------------
$result = mysql_query("SELECT playerid,race,xp FROM `table` WHERE playerid = 'STEAM_X:X:XXXXXX'");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf("PlayerID: %s || Race: %s || XP: %s<br>", $row[0], $row[1], $row[2]);
}
--------------------------------------------------------
This outputs the following:
PlayerID: STEAM_X:X:XXXXXX || Race: 1 || XP: 5000000
PlayerID: STEAM_X:X:XXXXXX || Race: 2 || XP: 5000000
PlayerID: STEAM_X:X:XXXXXX || Race: 3 || XP: 5000000
Is there anyway to make it so that if the race outputs "1", it's turned into "Hello" for example? So it would look like:
PlayerID: STEAM_X:X:XXXXXX || Race: Hello || XP: 5000000
I've tried meddling with IF statements (if (race == 1) echo('Blah Blah'); if (race == 2) echo('Blah Blah #2'); for example).
Any ideas? Sorry if this is somewhat confusing, hope you can understand it though

Cheers.