vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Corn Problem, please help (https://vborg.vbsupport.ru/showthread.php?t=77606)

miz 03-06-2005 04:12 PM

Corn Problem, please help
 
ok i made a script the delete info from some table,

now i added it to corn in admin cp to run every 1st of month

its apper like that

Code:

30        0        1        *        *
now the problem is that its never run :(

when i click on run now its works like a charm
but its dosent work alone

also in next time it says :
02-28-2005 11:30 PM

but date now is 06/03 and script didnt runned yet

any idea what might be the problem

thanks MiZ

miz 03-09-2005 03:53 PM

bump

please help... not supuse to be that hard

Marco van Herwaarden 03-09-2005 03:59 PM

Try posting the script. The scheduled tasks can be a bit tricky sometimes, had to learn that the hard way myself. Sometimes things run ok with Run Now, but fail when run scheduled.

miz 03-09-2005 04:10 PM

ok
here is the info of the file

scoreboardupdate.php
=================

Code:

error_reporting(E_ALL & ~E_NOTICE);

if (!is_object($DB_site))
{
        exit;
}


// Score board , Award system , Ratio system

       
 // looking for a winner

          $scorewinner =$DB_site->query("SELECT * FROM ".TABLE_PREFIX."user  order by tmsecs Desc limit 1");
        while ($scorewins = $DB_site->fetch_array($scorewinner)) {
               
        $totaltmsecs = $scorewins['tmsecs'];
        $winnername = $scorewins['username'];
        $winnerid = $scorewins['userid'];
        $lastmonth = $scorewins['tmsecs'];;

}

       
       
        // clear last month modes

          $DB_site->query("UPDATE ".TABLE_PREFIX."useraward SET award1 = '0'");
         
          // set new award winner
         
          $DB_site->query("UPDATE ".TABLE_PREFIX."useraward SET award1 = '1' where userid='$winnerid'");
         
          // upadte user ratio
       
          $DB_site->query("UPDATE ".TABLE_PREFIX."user SET credit =credit+50 where userid='$winnerid' ");
 
          // update winner last month secs
$DB_site->query("UPDATE ".TABLE_PREFIX."user SET lmsecs ='$lastmonth' where userid='$winnerid'");
          // clear all tmsecs of users       
          $DB_site->query("UPDATE ".TABLE_PREFIX."user SET tmsecs = 0");
          $DB_site->query("TRUNCATE TABLE ".TABLE_PREFIX."`scoreboard`");




log_cron_action('Scoreboard Updated', $nextitem);


Marco van Herwaarden 03-09-2005 05:38 PM

I don't see a good reason why it should not run in cron. Did you check if you maybe got a SQL-error mail?
A few remarks though:
- The table useraward, does it contain all users? If not the new winner might fail if it is the first time someone wins.
- No need to use quotes around numeric values in queries, only cast the value to an INT if it is a dirty value (user inputed).
- Not sure if that truncate statement will work correct when a table prefix is used, because of the back-tics.
- Does the run get logged in the cron-log?

miz 03-10-2005 05:25 PM

when i run the script with run now button its work perfect

and when i click on run now its get logged

but else its just not working.
script working great as script
but on corn its not get executed

Marco van Herwaarden 03-10-2005 05:30 PM

Well if it gets logged, then it is executed without a SQL-error.

Will try to look at it tomorrow (hmm why this sentence sounds familiar, hmmm think i forgot to do some things i promosed to do today :( )

What about the table being populated with all userids before the script is run?

miz 03-10-2005 05:54 PM

what about it >

Marco van Herwaarden 03-10-2005 05:55 PM

Does the useraward table already have an entry for every existing userid in it?

PHP Code:

      // set new award winner
      
      
$DB_site->query("UPDATE ".TABLE_PREFIX."useraward SET award1 = '1' where userid='$winnerid'"); 

You only do an update for the new winner, but what if this user never win before? Will there already be an (empty?) entry in the table?

miz 03-11-2005 02:24 PM

well then it shows as

USERID : 54
AWARD1 : 0

same for all users

Marco van Herwaarden 03-11-2005 03:39 PM

sorry don't really understand your reply

miz 03-11-2005 04:01 PM

Quote:

You only do an update for the new winner, but what if this user neverwin before? Will there already be an (empty?) entry in the table?
if there isnt a winner so under award1 you got 0

so in the useraward table you got all userid's that on board
and under award1 you got 0

so for exsample

userid : 5
award1 : 0

userid : 6
award1 : 0

0 means user dont have the award
if you will change 0 to 1
its means that user that have 1 got the award

and thats what

PHP Code:

// set new award winner
      
      
$DB_site->query("UPDATE ".TABLE_PREFIX."useraward SET award1 = '1' where userid='$winnerid'"); 

is doing its set new award winner by set award1 to 1 so he will be a winner

got it >

so the problem is for sure not on this line

Marco van Herwaarden 03-11-2005 04:03 PM

Ok, so that answers my question: Yes all userids are already in that table.

filburt1 03-11-2005 04:37 PM

Quote:

Originally Posted by miz
when i run the script with run now button its work perfect

and when i click on run now its get logged

but else its just not working.
script working great as script
but on corn its not get executed

Cron. Not corn.


All times are GMT. The time now is 04:43 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.01171 seconds
  • Memory Usage 1,752KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (14)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