PDA

View Full Version : Json Problem



manish soni
07-25-2012, 01:22 PM
Hello

I am using this code to get data in json, in that i need html code also but when i am uploading html code in database its getting store in database but in json output its not coming properly and beacause of that my json link is not working so can you please help me out?
I am trying to upload this code and its getting store in database but i am not getting proper out put so link is not working properly.

ex:- <iframe class=\"youtube-player\" type=\"text/html\" width=\"320\" height=\"480\" src=\"http://www.youtube.com/embed/5031kVaBBMU\" frameborder=\"0\" allowfullscreen></iframe>

Thanks,
Regards,
Manish Soni

JShor
07-25-2012, 05:40 PM
Which parameter isn't working? I don't understand what you're trying to accomplish here.



<?php
include("include/db_conn.php");
$appid=$_REQUEST['appid'];
$pageid=$_REQUEST['pageid'];
$parentid = $_REQUEST['parentid'];

if($pageid!='') {

$query1=mysql_query("select * from page_master where page_id='".$pageid."'");
while($rows1 = mysql_fetch_array($query1))
{
$pages1 [] = array(
'pageid' => $rows1['page_id'],
'title' => $rows1['page_title'],
'type' => $rows1['page_type'],
'desc' => $rows1['description'],
'Nexturl' => $rows1['url'],
'prevurl' => '48'
);
}

$data.='<pages>';

foreach( $pages1 as $page1 )
{
$data.='<page>';
$data.='<pageid>'.$page1['pageid'].'</pageid>';
$data.='<title>'.$page1['title'].'</title>';
$data.='<type>'.$page1['type'].'</type>';
$data.='<desc>'.$page1['desc'].'</desc>';
$data.='<Nexturl>'.$page1['Nexturl'].'</Nexturl>';
$data.='<prevurl>'.$page1['prevurl'].'</prevurl>';
$data.='</page>';
}

$data.='</pages>';

$sxml=simplexml_load_string($data);
echo str_replace("\/","/",json_encode($sxml));
// Output JSON.
}
?>