Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-02-2003, 01:19 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Getting burnt....need help, please.

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....
Attached Images
File Type: jpg games.jpg (36.2 KB, 0 views)
Reply With Quote
  #2  
Old 06-02-2003, 04:38 PM
Neo's Avatar
Neo Neo is offline
 
Join Date: Oct 2001
Location: Anywhere
Posts: 1,817
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How high does gameid numerical wise?
Reply With Quote
  #3  
Old 06-02-2003, 06:52 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
  #4  
Old 06-03-2003, 10:13 AM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmm...have I stumped the anyone here?
Reply With Quote
  #5  
Old 06-03-2003, 11:11 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

PHP Code:
$usergames[gameid
Can you do that?
Reply With Quote
  #6  
Old 06-04-2003, 11:36 AM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Attached Images
File Type: jpg games1.jpg (39.0 KB, 0 views)
Reply With Quote
  #7  
Old 06-04-2003, 11:50 AM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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","");

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:02 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05111 seconds
  • Memory Usage 2,262KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (2)postbit_attachment
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete