|
 |
|
INSERT ข้อมูลในไฟล์ .json ลงไปใน Mysql แบบวนลูป ทำอย่างไรได้คะ |
|
 |
|
|
 |
 |
|
ดูๆแล้วก็น่าจะประมาณนี้นะครับ 
ก็ดึงไฟล์มา แปลงกลับเป็น array มา foreach แล้วก็ insert ลงฐานข้อมูลได้เลยครับ
Code (PHP)
<?php
$f = file_get_contents('categories.json');
if(!function_exists('json_decode')) die('Your host does not support json');
$feed = json_decode($f);
foreach($feed as $key => $val){
echo $key." : ";
echo "Type = ".$val[0];
echo " Price = ".$val[1];
echo "<br/>";
//query เองน๊ะจ๊ะ
}
?>
|
ประวัติการแก้ไข 2014-05-07 00:08:21
 |
 |
 |
 |
Date :
2014-05-07 00:08:02 |
By :
dreamt256 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
Load balance : Server 02
|