Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lodow on github.
  • I am lodow (https://keybase.io/lodow) on keybase.
  • I have a public key whose fingerprint is A324 7FBB 54AB 2AD8 FD0D 8F67 1611 01DB CF6B 524D

To claim this, I am signing this object:

@lodow
lodow / Json to mysql
Last active August 6, 2021 18:04
Script to import json to mysql in php
<?php
$content = json_decode(file_get_contents("filename.json")), true);
mysql_connect('localhost', 'user', 'pass');
mysql_select_db('db');
foreach($content as $item) {
$columns = implode(", ",array_keys($item));
$escaped_values = array_map('mysql_real_escape_string', array_values($item));