Jump to content
MakeWebGames

Mass give mod


Leu

Recommended Posts

I am using MC Code Lite, and am trying to build a mass give mod for admins only. And I keep getting error

"Parse error: syntax error, unexpected '<' in /home/leu/public_html/admin.php on line 905

could someone reveiw this code and tell me what I am not seeing.

 

function mass_item_give()
{
global $ir,$c;
<form action='admin.php?action=giveitemsub' method='post'>
All Users "mysql_query("SELECT * FROM users ",$c,'user')."

Item: ".item_dropdown($c,'item')."

Quantity: <input type='text' name='qty' value='1' />

<input type='submit' value='Mass Item Give' /></form>";
}
function mass_item_submit()
{
global $ir,$c;
mysql_query("INSERT INTO inventory VALUES('',{$_POST['item']},{$_POST['user']},{$_POST['qty']})",$c) or die(mysql_error());
print "You gave  {$_POST['qty']}of item ID {$_POST['item']} to all users.";
}

 

any help would be great

Link to comment
Share on other sites

Re: Mass give mod

ok will try it out

ok got that part working but now when accessing the form, i can see all the fields but at the top of the form it is showing this error

Warning: Wrong parameter count for mysql_query() in /home/leu/public_html/admin.php on line 906

so how do i set the query to all user

Link to comment
Share on other sites

  • 2 months later...

Re: Mass give mod

This should do it. It's a bit more comprehensize than mccodes code normally is.

I find that for any code that exists on mccodes, I normally have to do at least twice as much code to make it work properly, and to keep the code readable. It's just lots of little things that would take way to much time to explain.

 

function mass_item_give() {
   global $ir,$c;

   // Line below this is where it was missing

   $item_dropdown = item_dropdown($c,'item');

   echo <<<EOT
   <form action="admin.php?action=giveitemsub" method="post">
   Give item to all awers.

   Item: $item_dropdown

   Quantity: <input type='text' name='qty' value='1' />

   <input type='submit' value='Mass Item Give' />
   </form>
EOT;

}

function mass_item_submit() {
   global $ir,$c;

   $q_users = mysql_query('select userid from users', $c);
   while (list($them_id) = mysql_fetch_array($q_users)) {

       mysql_query("INSERT INTO inventory (inv_itemid, inv_userid, inv_qty)
       VALUES('',{$_POST['item']},$them_id,{$_POST['qty']})",$c) or die(mysql_error());

   }

   print "You gave  {$_POST['qty']}of item ID {$_POST['item']} to all users.";
}

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