vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   if (https://vborg.vbsupport.ru/showthread.php?t=58702)

SmEdD 11-19-2003 06:01 PM

if
 
Is there a way to make a if run more then once.

I have to make it say

PHP Code:

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.

PHP Code:

while ( $game $DB_site->fetch_array $games ) )
{
  
$name "game_" $game['gameid'] ;
  if ( 
$clan_application["$name"] == )
  {
    
$show_titles.= $game['title']  . "<br />" 
  } 


Then use:

PHP Code:

$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 I’m 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


All times are GMT. The time now is 10:54 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01144 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete