html - Something is broken with system comments with JSON and PHP -


i have encountered issue using databased json files , php. include script called messages.php, , operates using id ref. it:

  • opens database connection,
  • queries row , column of current article,
  • decodes json data php_decode(),
  • and writes results page.

i think broken in json handling. json validated through 1 link posted on related question.

here's code:

<?php  //prepare database query, searching messages $query = "select * articles id =".$_get['id']." limit 1"; echo "<script>alert($query);</script>";  //create connection $con = mysqli_connect('localhost','empty_user','tough_pass','roadsidediner_menu');  //provide query , handle $result = mysqli_query($con,$query);  //aquire article row $row = mysqli_fetch_array($result);  echo $row;  //store json data $rough_json = $row['comments'];  //decode json file $json = json_decode($rough_jason,true); //???? var_dump[$json]; //never gets var dump      $html = "<div class='comment'>";     $html .= "<h5> said on ";     $html .= "</h5>";     $html .= "<p></p></div>";     echo $html;  $mysqli_close($con);  ?> 

these known issues: php script stops midway through main.php. happening somewhere in above code, maybe json? here's that:

{ "comments": [ { "name":"jon" ,    "lastname":"bucks" ,    "thedate":"may 1, 2013" ,    "message":"message test one" }, { "name":"joe" ,  "lastname":"buick" ,  "thedate":"june 6, 2013" ,  "message":"message test two" }, { "name":"jack" ,  "lastname":"brick" ,  "thedate":"december 2, 2013" ,  "message":"message test three"} ] } 

how'd it?


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -