Advanced Search

Results 1 to 2 of 2

Thread: Json Problem

  1. #1
    Join Date
    Jul 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Json Problem

    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

  2. #2
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    Which parameter isn't working? I don't understand what you're trying to accomplish here.

    Code:
    <?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.
    }
    ?>
    - Josh

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •