I have a json file i wanted to use as a database simply because I like the structure of json than mysql php i have the following code
$query = "people.json";
$json = file_get_contents($query);
$data = json_decode($json, true);
$faq = $data['FAQ'];
$questions = $faq['Questions']['Number'];
foreach($questions as $question){
$number = $question['number'];
$question = $question['question'];
$answer = $question['answer'];
?>
{
"FAQ":{
"Questions":{
"Number":{
"1":{
"number":"one",
"question":"How do i trade with Marketwh steam bots?",
"answer":"You can Trade one of 2 ways <br> Send a Trade offer to one of our Steam Bots <br> & #8226; find the item on our site see the price of it and then click trade and send a trade offer like normal."
},
"2":{
"number":"two",
"question":"What is a Steam Bot?",
"answer":"A Steam Bot is an automated Trading Bot that will automatcally accept offers sent to it that are within the item price range of buying or selling."
},
"3":{
"number":"three",
"question":"What is a Steam Bot?",
"answer":"A Steam Bot is an automated Trading Bot that will automatcally accept offers sent to it that are within the item price range of buying or selling."
},
"4":{
"number":"four",
"question":"",
"answer":""
},
"5":{
"number":"five",
"question":"",
"answer":""
}
}
}
}
}
$number outputs "one"
$question outputs the question
$answer outputs the first letter in the question variable for the first one it is "H" and the second and third answer it is a "W".
as you can see in the code above i have it in a foreach which should cycle through each of the numbers 1-4 in the FAQ array
I am using this to call in php for the database i can just edit and change the stuff with my website and FAQ is the FAQ page i will be using