Advertisement
Guest User

Untitled

a guest
Jan 28th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. function storeData(item){
  2. $.ajax({
  3. url: 'insert.php',
  4. type: 'POST',
  5. data: {
  6. var1: item
  7. }
  8. });
  9. }
  10.  
  11. <?php
  12. $host = "localhost:3306";
  13. $user = "root";
  14. $pass = "";
  15. $databaseName = "items";
  16. $tableName = "item_list";
  17.  
  18. $con = mysql_connect($host,$user,$pass);
  19. $dbs = mysql_select_db($databaseName, $con);
  20. ?>
  21.  
  22. <?php
  23. include_once('connection.php');
  24.  
  25. $itemNumber = $_POST['var1'];
  26. echo $_POST[$itemNumber];
  27. $sql = "INSERT INTO item_list (item_number) VALUES ($itemNumber)";
  28. mysql_query($sql) or die(mysql_error());
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement