SHARE
TWEET

Untitled

a guest Jun 17th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     $server = 'localhost';
  3.     $user = 'root';
  4.     $pass = '123456';
  5.     $db = 'db';
  6.  
  7.     $conexion = mysql_connect($server, $user, $pass);
  8.     mysql_select_db($db, $conexion);
  9.  
  10.     function Insertar($card_id){
  11.         $sql = 'INSERT INTO card (card_id) VALUES ("'.$card_id.'")' ;
  12.         $resultado = mysql_query($sql) or die ("Error: $sql. ".mysql_error());
  13.         return true;        
  14.     }
  15.  
  16.     $data = file_get_contents("all-cards.json");
  17.     $cards = json_decode($data, true);
  18.     $i=0;
  19.     foreach($cards as $card) {
  20.         Insertar($card['id']);
  21.         $i++;
  22.     }
  23.     mysql_close($conexion);
  24.     ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top