vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   PHP syntax problem (https://vborg.vbsupport.ru/showthread.php?t=75432)

Adrian Schneider 01-30-2005 05:18 PM

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') . '");');



miz 01-30-2005 05:31 PM

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

Adrian Schneider 01-30-2005 05:37 PM

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. :)

miz 01-30-2005 06:20 PM

heh np ;)
allways glad to help out

Added :

hm dont forget to replace the functions to work with $DB_site;

Adrian Schneider 01-30-2005 07:19 PM

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?

miz 01-30-2005 07:56 PM

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.


All times are GMT. The time now is 05:00 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.01185 seconds
  • Memory Usage 1,738KB
  • 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
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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