Advertisement
Guest User

Untitled

a guest
May 27th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. <?php
  2. $host = "localhost";
  3. $user = "root";
  4. $pass = "root";
  5. $db = "world";
  6.  
  7.     if(!empty($_POST))
  8.     {
  9.         $con = mysql_connect($host,$user,$pass) or die(mysql_error());
  10.         mysql_select_db($db) or die(mysql_error());
  11.         $itemsetid = mysql_real_escape_string($_POST['itemsetid']);
  12.         $vendorid = mysql_real_escape_string($_POST['vendorid']);
  13.         $itemextendedcost= mysql_real_escape_string($_POST['itemextendedcost']);
  14.        
  15.         $query = mysql_query("SELECT * FROM item_template WHERE itemset='$itemsetid'") or die (mysql_error());
  16.        
  17.         while($itemek = mysql_fetch_assoc($query))
  18.         {
  19.             $entry = $itemek["entry"];
  20.             mysql_query("INSERT INTO `npc_vendor` (`entry`,`item`,`ExtendedCost`) VALUES ('".$vendorid."','".$entry."','".$itemextendedcost."')") or die(mysql_error());
  21.         }
  22.        
  23.         echo "Sikeres addolás!";
  24.        
  25.         mysql_close($con);
  26.     }
  27. ?>
  28. <html>
  29.     <head>
  30.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  31.         <title>Itemadd</title>
  32.     </head>
  33.     <body>
  34.         <form action="" method="post">
  35.             ItemSet:<br /> <input type='text' name='itemsetid' /><br />
  36.             Vendor:<br /> <input type='text' name='vendorid' /><br />
  37.             ItemExtendedCost(ár):<br /> <input type='text' name='itemextendedcost' /><br />
  38.             <input type='submit' value='Beküld' />
  39.         </form>
  40.     </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement