Note that there are some explanatory texts on larger screens.

plurals
  1. POBig Json data to mysql
    primarykey
    data
    text
    <p>Im trying to import json data to mysql.My json file nearly 3.7Mb and have nearly 17k rows (test data real data will be nearly 65k rows ).But with my script its very slow and it takes nearly 8-9min.Is there any fast way to import json data to mysql with php progress interface ? And im trying to add progress bar feature and its works for now.</p> <pre><code>$veri=json_decode(file_get_contents('auctions.json')); $sayi=count($veri-&gt;alliance-&gt;auctions); $a=$veri-&gt;alliance-&gt;auctions; $yuzde=round($sayi/100); echo "&lt;div id='tasiyici'&gt;"; $sql=$db-&gt;prepare("INSERT INTO auctions (id, auc, item, owner, bid, buyout, quantity, timeLeft) VALUES ('',?,?,?,?,?,?,?)"); for ($i=0;$i&lt;=$sayi;$i++){ $sql-&gt;execute(array($a[$i]-&gt;auc,$a[$i]-&gt;item,$a[$i]-&gt;owner,$a[$i]-&gt;bid,$a[$i]-&gt;buyout,$a[$i]-&gt;quantity,$a[$i]-&gt;timeLeft)); if($i%$yuzde=='0'){ $y=$i/$yuzde; if(($y*4+4)&gt;"180"){$pos=40-(($y*4+4)-180); $color="color:#fff";} if(($y*4+4)&gt;=220){$pos=0;} echo "&lt;div class='rakam' style='background-position:-".$pos."px 0;".$color."'&gt;%".($y+1)."&lt;/div&gt;"; echo "&lt;div class='yuzde' style='width:".($y*4+4)."px;'&gt;&lt;/div&gt;"; ob_flush(); flush(); } } echo "&lt;/div&gt;"; echo "&lt;br&gt; $sayi data added."; </code></pre> <p>CSS Codes</p> <pre><code>&lt;style&gt; body { font-family:Arial; } #tasiyici { width:400px; height:17px; display: block; position: relative; margin:50px auto; background:#e3e3e3; border-radius:5px; overflow: hidden; border:1px solid #ccc; } .yuzde { height:17px; display: block; width:1px; background:url("progressOverlay.png"); position: absolute; top:0; left:0; z-index:1; } .rakam { width:40px; height:16px; display: block; line-height:17px; position: absolute; left:50%; top:0; margin-left:-20px; z-index:9999; background:url("progressOverlay.png") -40px 0 #e3e3e3 no-repeat; font-size:11px; } &lt;/style&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload