ryeman98 Posted July 5, 2008 Share Posted July 5, 2008 So there aren't any errors that pop up, it's just plain not working // SHOP RESTOCKING CRON $shops = mysql_query("SELECT * FROM `shops`"); $forward = time()+480; $res_time = date("F j - H:i"); // Current time $res_update_time = date("F j - H:i", $forward); // 8 minutes from now while ($shops_row = mysql_fetch_array($shops)) { $shop_id = $shops_row['id']; $restocks = mysql_query("SELECT * FROM `shop_restocking` WHERE shop_id='$shop_id'"); while ($restocks_row = mysql_fetch_array($restocks)) { $amount_items = $restocks_row['SUM(amount)']; // Total amount of items in the shop $i = $amount_items; if ($amount_items <= 5) { // If the amount of items equals 5 or less, continue if ($res_time >= $res_update_time) { // If the 8 minute wait is up, continue while ($i<=50) { // Loop while $i is less than 50 $restock_min = 1; $restock_max = $restocks_row['COUNT(id)']; $rand_num = rand($restock_min, $restock_max); // Picks a random number $res_check_id = mysql_query("SELECT * FROM `shop_restocking` WHERE item_id='$rand_num'"); // Check if the id exists if (!$res_check_id) { // If the id does not exist, do nothing } else { // If the id exists, continue $check_id_row = mysql_fetch_array($res_check_id); $rarity = $check_id_row['rarity']; // The item's rarity $amount = round($rarity/8); // The amount of items that will be entered $res_update = mysql_query("UPDATE `shop_restocking` SET amount='$amount' WHERE id='$rand_num'"); // Reset the amount } // End if $i=$i+$amount; } // End while } // End if } // End if } // End while } // End while So it works by checking the total amount of items in a shop. If there are less than 5 items, then the shop should wait 8 minutes and then be restocked. Then it just starts picking random items to put into the shop up until there are a total of at least 50 items. Link to comment https://forums.phpfreaks.com/topic/113387-code-problem/ Share on other sites More sharing options...
echoindia756 Posted July 5, 2008 Share Posted July 5, 2008 Do you write this code by hand? I'd suggest using Dreamweaver CS3 as it makes developing dynamic websites a piece of cake! Link to comment https://forums.phpfreaks.com/topic/113387-code-problem/#findComment-582558 Share on other sites More sharing options...
ryeman98 Posted July 5, 2008 Author Share Posted July 5, 2008 Do you write this code by hand? I'd suggest using Dreamweaver CS3 as it makes developing dynamic websites a piece of cake! I'm using Dreamweaver 8 because I prefer that but I still code by hand with it. I don't like how it adds stuff for you at the click of a button. Link to comment https://forums.phpfreaks.com/topic/113387-code-problem/#findComment-582563 Share on other sites More sharing options...
echoindia756 Posted July 5, 2008 Share Posted July 5, 2008 Try typing in this right after the first "<?php" ini_set ("display_errors", "1"); error_reporting(E_ALL); That should display any errors there are. Link to comment https://forums.phpfreaks.com/topic/113387-code-problem/#findComment-582574 Share on other sites More sharing options...
ryeman98 Posted July 5, 2008 Author Share Posted July 5, 2008 Got this: /includes/header.php on line 48 Notice: Undefined index: css in /home/vol1/byethost13.com/b13_1141145/errion.byethost13.com/htdocs/includes/header.php on line 125 Notice: Undefined index: HTTPS in /home/vol1/byethost13.com/b13_1141145/errion.byethost13.com/htdocs/includes/header.php on line 9 Link to comment https://forums.phpfreaks.com/topic/113387-code-problem/#findComment-582580 Share on other sites More sharing options...
echoindia756 Posted July 6, 2008 Share Posted July 6, 2008 Got this: /includes/header.php on line 48 Notice: Undefined index: css in /home/vol1/byethost13.com/b13_1141145/errion.byethost13.com/htdocs/includes/header.php on line 125 Notice: Undefined index: HTTPS in /home/vol1/byethost13.com/b13_1141145/errion.byethost13.com/htdocs/includes/header.php on line 9 You'll have to make those lines so their not relying on register_globals being on. Link to comment https://forums.phpfreaks.com/topic/113387-code-problem/#findComment-582587 Share on other sites More sharing options...
ryeman98 Posted July 6, 2008 Author Share Posted July 6, 2008 Got this: /includes/header.php on line 48 Notice: Undefined index: css in /home/vol1/byethost13.com/b13_1141145/errion.byethost13.com/htdocs/includes/header.php on line 125 Notice: Undefined index: HTTPS in /home/vol1/byethost13.com/b13_1141145/errion.byethost13.com/htdocs/includes/header.php on line 9 You'll have to make those lines so their not relying on register_globals being on. What? ??? Link to comment https://forums.phpfreaks.com/topic/113387-code-problem/#findComment-582589 Share on other sites More sharing options...
echoindia756 Posted July 6, 2008 Share Posted July 6, 2008 Ok, for example: Let's say one of the errors is $SelectProduct = $_GET['whatever']; You would put that near the top of the page, and then wherever the error is, you just right it so that it says: $SelectProduct; i.e remove everything after the equals, except the semi-colon of course. Link to comment https://forums.phpfreaks.com/topic/113387-code-problem/#findComment-582593 Share on other sites More sharing options...
ryeman98 Posted July 6, 2008 Author Share Posted July 6, 2008 Ok, for example: Let's say one of the errors is $SelectProduct = $_GET['whatever']; You would put that near the top of the page, and then wherever the error is, you just right it so that it says: $SelectProduct; i.e remove everything after the equals, except the semi-colon of course. Two of those are if statments so it wouldn't make any sense. Link to comment https://forums.phpfreaks.com/topic/113387-code-problem/#findComment-582595 Share on other sites More sharing options...
echoindia756 Posted July 6, 2008 Share Posted July 6, 2008 You know what I mean anyway. Link to comment https://forums.phpfreaks.com/topic/113387-code-problem/#findComment-582596 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.