Jump to content
MakeWebGames

help with something


Recommended Posts

I need some help with something, like on the give item to user function or give item to all users either one, I want to post an even that tells them what item I gave them. So far the even tells them that I gave them X amount of item id # X. Lol how many users or me for that matter know what every items id# is. So what should I put in the script to get the itmname??

 

function mass_give_item_sub()
{
global $db,$ir,$c;
$q=mysql_query("SELECT * FROM users WHERE fedjail=0",$c);
while($r=mysql_fetch_array($q))
{
item_add($r['userid'], $_POST['item'], $_POST['qty']);
event_add($r['userid'],"The population has just been given an item {$_POST['item']}, Click [url='inventory.php']Here[/url] to check.",$c);
print "Item Sent To {$r['username']}</br>";
}
print "
Mass item sending complete!</br>
Theres no need to send a mass mail because they just got an event.";
}
Link to comment
Share on other sites

Guest Anonymous

Re: help with something

Mmm, be careful though -- Inserting too many records in one hit can cause too much load on the DB server, think about adding only when necessary - i.e. on login or next page hit.

Link to comment
Share on other sites

Re: help with something

 

function mass_give_item_sub()
{
	global $db,$ir,$c;
	$id=mysql_query("SELECT * FROM items WHERE itmid = {$_POST['item']} LIMIT 1",$c) or die(mysql_error());
	$item=mysql_fetch_array($id);
	$q=mysql_query("SELECT * FROM users WHERE fedjail=0",$c);
	while($r=mysql_fetch_array($q))
		{
			item_add($r['userid'], $_POST['item'], $_POST['qty']);
			event_add($r['userid'],"The population has just been given {$_POST['item']} of {$item['itmname']}, Click [url='inventory.php']Here[/url] to check.",$c);
			print "Item Sent To {$r['username']}</br>";
		}
	print "
Mass item sending complete!</br>
	Theres no need to send a mass mail because they just got an event.";
}

 

That should do what you want I think. Its not tested as I have no way to try it out. However like Nyna stated its going to create a mass amount of database entries. Might be better to do something like a single news entry for them instead.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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...