Jump to content


Need help with a script

  • Please log in to reply
1 reply to this topic

#1 x_789

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 11 May 2003 - 03:18 PM

Hi I have a Table I need a script that will look at field user_posts and if it has 5 or more posts. To give 5 points to field user_points. If they do not have 5 posts or more it will not give them any points. Here is what I have that will reset everyone to zero

define(\'IN_PHPBB\', true); 

$phpbb_root_path = \'./\'; 

include($phpbb_root_path . \'extension.inc\'); 

include($phpbb_root_path . \'common.\'.$phpEx); 

include($phpbb_root_path . \'includes/functions_selects.\'.$phpEx); 


\'UPDATE \'.USERS_TABLE.\' SET user_points=0 \' 


$userdata = session_pagestart($user_ip, PAGE_INDEX); 


if ( $userdata[\'user_level\'] != ADMIN ) 

      message_die(GENERAL_ERROR, "You are not Authorised to do this"); 




   if(!$result = $db->sql_query($sql[$n])) 

   $message.="Failed to update line: ".($n+1)." , ".$sql[$n]."<br />"; 

   else $message.="Succes line: ".($n+1)." , ".$sql[$n]."<br />"; 



message_die(GENERAL_MESSAGE, $message); 


Both fields I listed user_points and user_posts are in the same Table phpbb_users .... Any help is greatly appricated.. As of right now I have to manually add points to each user and its very time consuming. Thanks X

#2 gizmola

  • Administrators
  • Advanced Member
  • 4,664 posts
  • LocationLos Angeles, CA USA

Posted 12 May 2003 - 08:27 AM

You just need to execute a simple query like this:

UPDATE phpbb_users SET user_points = 5 where user_posts >= 5

I\'ll leave it to you, to figure out how to get php to execute that for you 8)

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users