vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Need Help With Passing Var To Function (https://vborg.vbsupport.ru/showthread.php?t=134668)

paul41598 12-23-2006 04:06 PM

Need Help With Passing Var To Function
 
I can't get this to work for the love of god, need assistance. Basically Im grabbing some data where theres a condition, if meet it sends off a PM.

I think the trouble is passing of variables. Because the PM arrays, etc arnt getting passed into the send_pm() function. I mean, I think they are but it is echoing back the wrong results, errr, wrong format anyways.


Code:

$userpointsqry = $vbulletin->db->query_read("
        SELECT score_times, ptp_log, userid, username
        FROM " . TABLE_PREFIX . "user
        WHERE score_times >= " . $vbulletin->options['ptp_groan_amount_level1'] . "
");

$pmto_users = array();
                               
while($pquery = $vbulletin->db->fetch_array($userpointsqry))
{

$pmto_users[] = $pquery['username'];  // initiliaze array for PM sending


// if rows are less than 1, PM to that person, if multiple, select ALL receipients

if ($vbulletin->db->num_rows($userpointsqry) <= 1)
{
$pmtousernames = $pquery['username'];
}
else {
$pmtousernames = implode(';', $pmto_users);
}


// Lets update the users points now
 $vbulletin->db->query_write("
 UPDATE " . TABLE_PREFIX . "user
 SET        vbbux =  '" . $amt1 . "'
 WHERE score_times >= " . $vbulletin->options['score_amount_level1'] . "
");
 start_pm(); // SEND THE PM!!

} // end while loop



// Start Private Message Code
function start_pm()
{

echo "$pmtousernames";  //this is just for testing purposes to see what it displays

// THE ABOVE DISPLAYS    CMUrickCMUrick;Pepsico
// SUPPOSED TO DISPLAY  CMUrick;Pepsico


}


I tried putting like "global $vbulletin, $pquery, $pmto_users, $userpointsqry, $pmtousernames;" right after:
function start_pm()
{

but that didnt help either.


All times are GMT. The time now is 04:52 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.00984 seconds
  • Memory Usage 1,710KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)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