Jump to content

Code Problem


ryeman98

Recommended Posts

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
Share on other sites

Do you write this code by hand? I'd suggest using Dreamweaver CS3 as it makes developing dynamic websites a piece of cake!  ;D

 

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.