Click here to Skip to main content
15,878,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a page call json_1.php where the code is
<?php



mysql_connect("localhost","root","root") or die("NOT CONNECTED WITH LOCALHOST");
mysql_select_db("tems");


$sql = mysql_query("SELECT * FROM prm_country");
while($row = mysql_fetch_assoc($sql)):

$arr[] = $row;

endwhile;

echo json_encode($arr);


?>


i am fetching data from next page call get_json.php
<?php



$json = file_get_contents("json_1.php");
$v = json_decode($json);

var_dump($v);

?>
But i cant fetch data from json_1.php
Posted

1 solution

Refer this links :

json_decode[^]

How to access JSON decoded array in PHP[^]


decode json in php and get each array value[^]


It may help you....

All the best.... :):):)
 
Share this answer
 
Comments
sameerPHP 1-Jun-14 2:32am    
given error Warning: Invalid argument supplied for foreach() in C:\AppServ\www\json\get_json.php on line 17

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900