Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

how to parse json into php -


i have json data retrieved data base i.e

$result=array(); $query="select * fish"; $result1 = mysql_query($query, $conn); while ($table = mysql_fetch_array($result1, mysql_assoc)){    $result[]=$table; }    echo json_encode($result);
, give me result
[{"fish_id":"1","name":"first fish update","info":"this first fish update","image":"http:\/\/www.localhost\/cafe\/pics\/logout (1).gif"}]

but page when call json data i.e

$input = file_get_contents("http://localhost/fish/fish-json.php"); $json=json_decode($input); echo $json->fish_id;

it give me error

notice: trying property of non-object in /var/www/fish/json-to-php.php on line 13 call stack: 0.0005 318764 1. {main}() /var/www/fish/json-to-php.php:0

is array of object, so

echo $json[0]->fish_id; 

to loop

if (!is_array($json)) die('...'); foreach ($json $key=>$fish) {   echo $fish->fish_id; } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -