vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Getting burnt....need help, please. (https://vborg.vbsupport.ru/showthread.php?t=53737)

Dark_Wizard 06-02-2003 12:19 PM

Getting burnt....need help, please.
 
1 Attachment(s)
I need another pair of eyes to help me with this query, first I will list the schema of both tables,

membergames:
membergamesid
userid
gameid

games:
gameid
gamename

here is the query I'm trying to create which is listing all the available games in the games table and then using a makeyesnocode to give the option to select the game and also provide for the one the user has already selected, it's not working right (see screenshot). Here is the query I'm using:

PHP Code:

  maketableheader("Member Games");
  
$usergames=$DB_site->query_first("SELECT * FROM vwar_membergames WHERE userid=$userid");
  
$membergames=$DB_site->query("SELECT gameid,gamename FROM vwar_games ORDER BY gamename ASC");
  while (
$membergame=$DB_site->fetch_array($membergames)) {
    
$varname="$usergames[gameid]";
    
makeyesnocode($membergame[gamename],$usergames[gameid],$usergames[$varname]);
  } 

Thanks....

Neo 06-02-2003 03:38 PM

How high does gameid numerical wise?

Dark_Wizard 06-02-2003 05:52 PM

Quote:

Today at 01:38 PM Neo said this in Post #2
How high does gameid numerical wise?

it is set to smallint (5) and right now my highest game is gameid=20

There is nothing here that will affect my results...

Dark_Wizard 06-03-2003 09:13 AM

Hmmm...have I stumped the anyone here?

Boofo 06-03-2003 10:11 AM

You're pulling each part of this out of 2 different queries:

PHP Code:

$usergames[gameid

Can you do that?

Dark_Wizard 06-04-2003 10:36 AM

1 Attachment(s)
Quote:

Yesterday at 08:11 AM Boofo said this in Post #5
You're pulling each part of this out of 2 different queries:

PHP Code:

$usergames[gameid

Can you do that?

Well I redid the whole thing and now it works except my alt rows look horrilbe...here is what I now have:
PHP Code:

maketableheader("Member Games");
  
$result=$DB_site->query("SELECT * FROM vwar_games ORDER BY gamename ASC");
  while(
$game=$DB_site->fetch_array($result)) 
  {
    
$result2=$DB_site->query_first("SELECT COUNT(membergamesid) FROM vwar_membergames 
      WHERE userid='
$userid' AND gameid='".$game["gameid"]."'");
      echo 
"<tr class='".getrowbg()."'><td>".
      
makeyesnocode("$game[gamename]","$game[gameid]","$result2[0]")."</td></tr>\n";


Any ideas?

Dark_Wizard 06-04-2003 10:50 AM

Ok...figured it out...here is the new code:
PHP Code:

  maketableheader("Member Games");
  
$result=$DB_site->query("SELECT * FROM vwar_games ORDER BY gamename ASC");
      echo 
"<tr class='".getrowbg()."'>";
  while(
$game=$DB_site->fetch_array($result)) 
  {
    
$result2=$DB_site->query_first("SELECT COUNT(membergamesid) FROM vwar_membergames 
      WHERE userid='
$userid' AND gameid='".$game["gameid"]."'");
      echo 
"<td>".
      
makeyesnocode("$game[gamename]","$game[gameid]","$result2[0]")."</td>";
      echo 
"</tr>\n";
  }
  
doformfooter("Modify Profile","");




All times are GMT. The time now is 11:13 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.01694 seconds
  • Memory Usage 1,746KB
  • 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
  • (5)bbcode_php_printable
  • (2)bbcode_quote_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