PDA

View Full Version : A messed up problem


SmEdD
08-17-2003, 04:35 AM
Ok lets say "game_1" is a column in "tablea"

"tableb" is where the name of the game is. The gameid is 1 and that is how it will find the name of the game.

How do I get game_1 to 1.

Dean C
08-17-2003, 11:00 AM
You just confused me totally. You're trying to join the tables though right?

NTLDR
08-17-2003, 12:56 PM
SELECT *.tablea,*.tableb FROM tablea
LEFT JOIN tableb USING (gameid);

SmEdD
08-17-2003, 04:34 PM
I also need to get game_ seprated from 1.

It runs like profile feilds. It add game_(id) into the tables where the data goes and not the title and stuff.

I'm trying to say if game_1 get $gameid['1'] or if game_2 get $gameid['2']

Like I said I want game_ droped but the number left behind.

EDIT: Added to pics also trying to help explain.

SmEdD
08-17-2003, 04:55 PM
And rember these can't be hard coded in thats why I need a code say game_# = #

SmEdD
08-17-2003, 06:57 PM
Got it after looking at so much stuff trying to figure it out.

$games = $DB_site->query("
SELECT *
FROM clan_game
ORDER BY displayorder
");

$gameinfo = array();
while ($game = $DB_site->fetch_array($games))
{
$varname = "game_$game[gameid]";
$game['varname'] = $varname;
$gameinfo[] = $game;

if (isset($_REQUEST["$varname"]))
{
$value = &$_REQUEST["$varname"];
}
else
{
$value = '';
}
}
unset($gamejoin);
foreach ($gameinfo AS $index => $value)
{
if ($application["$value[varname]"] == 1)
{
$gamenames = $DB_site->query("
SELECT *
FROM clan_game
WHERE gameid = " . $value['gameid'] . "
");

$gamename = $DB_site->fetch_array($gamenames);
$gamejoin .= "" . $gamename['game'] . "<br />";
}
else
{
$gamejoin = '&nbsp';
}
}