i am learning php/sql/wamp and have encountered much trouble on a learning project...
i have a txt file below ive finally figured out away to load it into php however i cant figure out how to approach creating the database sql needed to insert this data into and perform queries... is there a good link or tutorial or perhaps sample code? below is my php and txt code
<?php
error_reporting(E_ERROR);
$header = '<?xml version="1.0" encoding="UTF-8"?>'."\n<datalist>";
$content = $header."\n".file_get_contents("data.txt")."\n</datalist>";
$ob = simplexml_load_string($content);
$json = json_encode($ob);
$array = json_decode($json, true);
$alldata = $array["pub"];
foreach ($alldata as $key => $value) { //access all data in loop
$id = $value["ID"];
$title = $value["title"];
$year = $value["year"];
$booktitle = $value["booktitle"];
$pages = $value["pages"];
$authors = implode(",", $value["authors"]["author"]);
//All process data can available here .run your sql query for insert.
}
?>
and my txt file below.. same format but for 50mb of data
<pub>
<ID>0</ID>
<title>Regression Time Warping for Similarity Measure of Sequence</title>
<year>2004</year>
<booktitle>CIT</booktitle>
<pages>826-830</pages>
<authors>
<author>Hansheng Lei</author>
<author>Venu Govindaraju</author>
</authors>
</pub>
<pub>
<ID>1</ID>
<title>A Computational Model for Face Location Based on Cognitive Principles</title>
<year>1992</year>
<booktitle>AAAI</booktitle>
<pages>350-355</pages>
<authors>
<author>Venu Govindaraju</author>
<author>Sargur N. Srihari</author>
<author>David B. Sher</author>
</authors>
</pub>