View Full Version : if
SmEdD
11-19-2003, 06:01 PM
Is there a way to make a if run more then once.
I have to make it say
if($clan_application['game_' . $game['gameid'] == '1' . '')
$game['title'] = $game['title'] . ' <br /> ' . ;
}
else
{
$game['title'] = '';
}
I also can't hard code it as the games get added dynamically. It adds a row in one table and adds a column in another.
If someone is smart enough for a solution which I belive there will be here I praise you.
assassingod
11-19-2003, 06:07 PM
Have you tried an while/do while loop?
SmEdD
11-20-2003, 02:16 AM
Ok I should try to explain this a bit better.
- Query the games table for the ID's
- Now the ID's are used to form the game_$id columns in the roster table.
- Columns have to be checked for a 0 or a 1.
- If it is a 1 we must now get the game name.
- There are multiple games and the are always added and deleted so it can't be hard coded as I have stated before.
I also want to keep the queries limited.
g-force2k2
11-21-2003, 04:01 AM
use the while loop ( as Assassin said ) when getting the data from the database...
ie.
while ( $game = $DB_site->fetch_array ( $games ) )
{
$name = "game_" . $game['gameid'] ;
if ( $clan_application["$name"] == 1 )
{
$show_titles.= $game['title'] . "<br />" ;
}
}
Then use:
$show_titles
to display all of the titles.
Regards,
g-force2k2
SmEdD
11-21-2003, 08:08 PM
Hey thanks a lot man, I didn't think it would work cause Im not to familiar with the while loop and how it works.
I really appreciate this!
And if you don't mind me asking, does the space before the ) or after the ( do anything, or is it just style.
Dean C
11-21-2003, 08:24 PM
^^ It just makes it easier to read.
g-force2k2
11-21-2003, 10:20 PM
Yeah like Mist said, and also because its just my style of coding. I actually have an even different style of coding but i stuck with what I created because I figured it would be easier for you to understand.
Regards,
g-force2k2
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.