-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjson_mysql_parser.php
More file actions
28 lines (19 loc) · 832 Bytes
/
json_mysql_parser.php
File metadata and controls
28 lines (19 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
/*MovieSearch - Searching Movies with Keywords or Genre
@author: Avinash
@filename: json_mysql_parser.php
@date: 28 Aug 2015
@version: 1.0 JSON to MySQL Processor
*/
require("settings.php");
require("data.php");
$parsing = json_decode($data_source);
foreach($parsing as $entity) {
$query = "INSERT INTO movies values('$entity->plot','$entity->rated','$entity->language','$entity->title','$entity->country','$entity->writer','$entity->year','$entity->metascore','$entity->imdb_id','$entity->director','$entity->released','$entity->imdb_rating','$entity->awards','$entity->poster','$entity->genre','$entity->actors','$entity->runtime','$entity->type','$entity->response','$entity->imdb_votes');";
if(mysql_query($query)) {
echo "Success<br>";
} else {
echo "failed<br>";
}
}
?>