michaelbraden Posted February 3, 2014 Posted February 3, 2014 I am seriously needing some help. I am trying to get my Mobster of The hour Script working. I have located the script at /moth.php and I need the script to run. Here is everything on moth.php <? $result = mysql_query("SELECT id, hourlyattacks FROM grpgusers WHERE hourlyattacks > 0 DESC LIMIT 1"); $rows = mysql_num_rows($result); if($rows == 1) { $fetch = mysql_fetch_array($result); send_event($fetch['id'], "You won mobster of the hour with ".$fetch['hourlyattacks'].""); $result = mysql_query("UPDATE grpgusers SET points = points + 10 WHERE id = '".$fetch['id']."'"); $reset = mysql_query("UPDATE grpgusers SET hourlyattacks = '0'"); } ?> Anyhow I am using a cpanel for crons but I got no idea howthis works as I am completly new! Please help me out guys! I want the script to see how many 'hourlyattacks' there are, take the highest, reward points, and reset hourlyattacks and start over.... someone help please? Quote
Newbie Posted February 3, 2014 Posted February 3, 2014 (edited) UPDATED but not tested <?php include('dbcon.php'); $result = mysql_query("SELECT id, hourlyattacks FROM grpgusers WHERE hourlyattacks > 0 DESC LIMIT 1"); $fetch = mysql_fetch_array($result); $usr = new User($fetch['id']); $newpoints = $usr->points + 10; Send_Event($usr->id, "You won mobster of the hour with ".$fetch['hourlyattacks'].""); $result = mysql_query("UPDATE grpgusers SET points = ".$newpoints." WHERE id = '".$usr->id."'"); $reset = mysql_query("UPDATE grpgusers SET hourlyattacks = '0'"); } ?> Edited February 3, 2014 by Newbie Quote
Guest Posted February 3, 2014 Posted February 3, 2014 There is no connection to the database, everything is empty, try including the connection file at the top then run the queries. Quote
michaelbraden Posted February 3, 2014 Author Posted February 3, 2014 I get this error when trying to run this Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/silentm2/public_html/moth.php on line 9 <?php include 'dbcon.php'; include 'classes.php'; include 'updates.php'; $result = mysql_query("SELECT id, hourlyattacks FROM grpgusers WHERE hourlyattacks > 0 DESC LIMIT 1"); $rows = mysql_num_rows($result); if($rows == 1) { $fetch = mysql_fetch_array($result); $usr = new User($fetch['id']); send_event($usr->id, "You won mobster of the hour with ".$fetch['hourlyattacks'].""); $result = mysql_query("UPDATE grpgusers SET points = points + 10 WHERE id = '".$usr->id."'"); $reset = mysql_query("UPDATE grpgusers SET hourlyattacks = '0'"); } ?> <?php include 'dbcon.php'; include 'classes.php'; include 'updates.php'; $result = mysql_query("SELECT id, hourlyattacks FROM grpgusers WHERE hourlyattacks > 0 DESC LIMIT 1"); $rows = mysql_num_rows($result); if($rows == 1) { $fetch = mysql_fetch_array($result); $usr = new User($fetch['id']); send_event($usr->id, "You won mobster of the hour with ".$fetch['hourlyattacks'].""); $result = mysql_query("UPDATE grpgusers SET points = points + 10 WHERE id = '".$usr->id."'"); $reset = mysql_query("UPDATE grpgusers SET hourlyattacks = '0'"); } ?> Quote
Newbie Posted February 3, 2014 Posted February 3, 2014 try <?php include('dbcon.php'); $result = mysql_query("SELECT * FROM grpgusers ORDER BY hourlyattacks DESC LIMIT 1"); $fetch = mysql_fetch_array($result); $usr = new User($fetch['id']); $newpoints = $usr->points + 10; Send_Event($usr->id, "You won mobster of the hour with ".$fetch['hourlyattacks'].""); $result = mysql_query("UPDATE grpgusers SET points = ".$newpoints." WHERE id = '".$usr->id."'"); $reset = mysql_query("UPDATE grpgusers SET hourlyattacks = '0'"); } ?> Quote
michaelbraden Posted February 3, 2014 Author Posted February 3, 2014 Wow you rock! Fixed thanks soo much buddy! Seriously!!! - - - Updated - - - If you know where I can come across help with gradient names? Or just extra dailies for GRPG That would be great!! Quote
Newbie Posted February 3, 2014 Posted February 3, 2014 np glad to help there is a bunch of free mods in the grpg freebies section. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.