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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-30-2005, 05:18 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default PHP syntax problem

Could someone help me get this to work? (an onClick popup to processes something) It works for me in template, but since its inside of php tags I just get errors ).

PHP Code:
/////////////////////////////////////////////////////////
// List Games ///////////////////////////////////////////
/////////////////////////////////////////////////////////
if ($_REQUEST['do'] == 'listgames')
{
  
$playerlist=mysql_query("SELECT * FROM game WHERE winner='$requested' OR loser='$requested' ORDER BY gameid DESC");
  while(
$playerlist1=mysql_fetch_array($playerlist))
  {
   
$listwinner=$playerlist1['winner'];
   
$listloser=$playerlist1['loser'];
   
$listwinnerrating=$playerlist1['winnerrating'];
   
$listloserrating=$playerlist1['loserrating'];
   
$playerlistbit .= "<tr><td>$listwinner</td><td>$listwinnerrating</td><td>$listloser</td><td>$listloserrating</td><if condition=$bbuserinfo['usergroupid'] == 6><td><a onClick=window.open('league_removegame.php?g=$listgameid&wr=$listwinnerrating&lr=$listloserrating','displayWindow','toolbar=no,scrollbars=no,width=1,height=1')/;><img src=http://www.starcraftdream.com/forums/images/league/removegame.gif></td></if></tr>";
  }
  eval(
'print_output("' fetch_template('league_listgames') . '");');

Reply With Quote
  #2  
Old 01-30-2005, 05:31 PM
miz miz is offline
 
Join Date: Mar 2003
Posts: 416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

where $requested get set ? via form,http or what ?

i think its should be $_REQUEST['requested']

also use $DB_site functions

about

PHP Code:
  $playerlistbit .= "<tr><td>$listwinner</td><td>$listwinnerrating</td><td>$listloser</td><td>$listloserrating</td><if condition=$bbuserinfo['usergroupid'] == 6><td><a onClick=window.open('league_removegame.php?g=$listgameid&wr=$listwinnerrating&lr=$listloserrating','displayWindow','toolbar=no,scrollbars=no,width=1,height=1'  )/;><img src=http://www.starcraftdream.com/forums/images/league/removegame.gif></td></if></tr>"


i think you will might want to create new template with this line and then just do

PHP Code:
eval('$playerlistbit .= "' fetch_template('playerlistbit_template') . '";'); 
will be better for sure
Reply With Quote
  #3  
Old 01-30-2005, 05:37 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It gets requested earlier in the page. Okay thanks, I wasn't sure how to use the .= thing incombination with templates. Your mighty helpful today.
Reply With Quote
  #4  
Old 01-30-2005, 06:20 PM
miz miz is offline
 
Join Date: Mar 2003
Posts: 416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

heh np
allways glad to help out

Added :

hm dont forget to replace the functions to work with $DB_site;
Reply With Quote
  #5  
Old 01-30-2005, 07:19 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will do. I have heard this from a lot of people now, what is the difference/benefit of doing it that way versus the traditional non vb way?
Reply With Quote
  #6  
Old 01-30-2005, 07:56 PM
miz miz is offline
 
Join Date: Mar 2003
Posts: 416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TheSpecialist
Will do. I have heard this from a lot of peoplenow, what is the difference/benefit of doing it that way versus thetraditional non vb way?
Quote:
Simply put, db_mysql saves you a lot of work and time. If you use thenative functions you will be witting a lot of error checking code forthings db_mysql can handle on the fly. If you use db_mysql you spendmore time witting clean SQL, instead of witting php code to handleerrors when that SQL may fail (and it will).

All is not lost, you didn't learn the native php functions for nothing.db_mysql is built upon these functions, so just think of db_mysql as acleaner, faster, more efficient way of talking with mysql.
read this thread

https://vborg.vbsupport.ru/showthread.php?t=75207

it might help you abit.
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 06:24 PM.


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.03552 seconds
  • Memory Usage 2,221KB
  • Queries Executed 13 (?)
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
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete