Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 147235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:44:45+00:00 2026-05-11T08:44:45+00:00

I am using JSON to parse data and connect to a PHP file. I

  • 0

I am using JSON to parse data and connect to a PHP file. I am not sure what the problem is because I am a newbie to flex. This is the error I am receiving:

JSONParseError: Unexpected < encountered     at com.adobe.serialization.json::JSONTokenizer/parseError()     at com.adobe.serialization.json::JSONTokenizer/getNextToken()     at com.adobe.serialization.json::JSONDecoder/nextToken()     at com.adobe.serialization.json::JSONDecoder()     at com.adobe.serialization.json::JSON$/decode()     at DressBuilder2/getPHPData()     at DressBuilder2/__getData_result()     at flash.events::EventDispatcher/dispatchEventFunction()     at flash.events::EventDispatcher/dispatchEvent()     at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()     at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()     at mx.rpc::Responder/result()     at mx.rpc::AsyncRequest/acknowledge()     at DirectHTTPMessageResponder/completeHandler()     at flash.events::EventDispatcher/dispatchEventFunction()     at flash.events::EventDispatcher/dispatchEvent()     at flash.net::URLLoader/onComplete() 

Here is the actual mxml code:

<?xml version='1.0' encoding='utf-8'?> <mx:Application xmlns:mx='http://www.adobe.com/2006/mxml' layout='absolute'  width='535' height='345'> <mx:Script> <![CDATA[  import mx.events.DataGridEvent;  import mx.controls.TextInput;  import mx.rpc.events.ResultEvent;  import mx.collections.ArrayCollection;  import com.adobe.serialization.json.JSON;   [Bindable]  private var dataArray:ArrayCollection;   private function initDataGrid():void  {    dataArray = new ArrayCollection();    getData.send();  }   private function getPHPData(event:ResultEvent):void  {    var rawArray:Array;    var rawData:String = String(event.result);    rawArray = JSON.decode(rawData) as Array;    dataArray = new ArrayCollection(rawArray);  }   private function sendPHPData():void  {    var objSend:Object = new Object();    var dataString:String = JSON.encode(dataArray.toArray());    dataString = escape(dataString);    objSend.setTutorials = 'true';    objSend.jsonSendData = dataString;    sendData.send(objSend);  }   private function updatedPHPDataResult(event:ResultEvent):void  {    lblStatus.text = String(event.result);  }   private function checkRating(event:DataGridEvent):void  {    var txtIn:TextInput = TextInput(event.currentTarget.itemEditorInstance);    var curValue:Number = Number(txtIn.text);    if(isNaN(curValue) || curValue < 0 || curValue > 10)    {      event.preventDefault();      lblStatus.text = 'Please enter a number rating between 0 and 10';    }   } ]]> </mx:Script>  <mx:HTTPService id='getData' url='http://www.keishalexie.com/imd465/forum.php'  useProxy='false' method='GET' resultFormat='text'  result='getPHPData(event)'> <mx:request xmlns=''>   <getTutorials>'true'</getTutorials>   </mx:request> </mx:HTTPService> <mx:HTTPService id='sendData' url='http://www.keishalexie.com/imd465/forum.php'  useProxy='false' method='GET' resultFormat='text'  result='updatedPHPDataResult(event)'> </mx:HTTPService> <mx:Binding source='dgData.dataProvider as ArrayCollection'  destination='dataArray'/> <mx:Panel x='0' y='0' width='535' height='345' layout='absolute'  title='Forum'>   <mx:DataGrid id='dgData' x='10' y='10' width='495' height='241'    dataProvider='{dataArray}' creationComplete='{initDataGrid()}'    editable='true' itemEditEnd='{checkRating(event)}'>     <mx:columns>     <mx:DataGridColumn headerText='Name' dataField='name' editable='false'/>     <mx:DataGridColumn headerText='Author' dataField='author' width='115'        editable='false'/>     <mx:DataGridColumn headerText='Rating' dataField='rating' width='50'        editable='true' />   </mx:columns>   </mx:DataGrid>  <mx:Button x='10' y='259' label='UpdateDatabase' id='butUpdate'    click='{sendPHPData()}'/>    <mx:Label x='140' y='261' id='lblStatus'/>  </mx:Panel>  </mx:Application> 

Here is the PHP:

<?php   $USERNAME = '';   //database username   $PASSWORD = '';    //database password   $DATABASE = '';   //database name   $URL = '';        //database location    if(isset($_GET['getTutorials'])) {     mysql_connect($URL, $USERNAME, $PASSWORD);     mysql_select_db($DATABASE) or die('Cannot connect to database.');      $returnArray = array();      $query = 'SELECT * FROM Tutorials';     $result = mysql_query($query);      while($row = mysql_fetch_assoc($result)) {       array_push($returnArray, $row);     }      mysql_close();     echo json_encode($returnArray);   }   elseif(isset($_GET['setTutorials'])) {      $jsonString = urldecode($_GET['jsonSendData']);      $jsonString = str_replace('\\', '', $jsonString);      $data = json_decode($jsonString, true);       mysql_connect($URL, $USERNAME, $PASSWORD);      mysql_select_db($DATABASE) or die('Cannot connect to database.');       foreach ($data as $tutorialEntry) {        $query = sprintf(         'UPDATE Tutorials SET rating = '%s' WHERE id = '%s'',        mysql_real_escape_string($tutorialEntry['rating']),        mysql_real_escape_string($tutorialEntry['id']));         $result = mysql_query($query);         if(!$result) {          mysql_close();          echo mysql_error();          return;        }      }       mysql_close();      echo 'database updated';    } ?> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:44:46+00:00Added an answer on May 11, 2026 at 8:44 am

    Visiting http://www.keishalexie.com/imd465/forum.php?getTutorials=1 (Which is what your code is calling) returns

    Fatal error: Call to undefined function: json_encode() in /homepages/38/d177816689/htdocs/keishalexie/imd465/forum.php on line 23

    Which is not a json document.

    Visit http://www.keishalexie.com/imd465/forum.php?getTutorials=1 in your browser as you fix the problem. Then once it looks good there, start working on the FLEX side of things.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 109k
  • Answers 109k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm not aware of any built-in functionality that can do… May 11, 2026 at 9:24 pm
  • Editorial Team
    Editorial Team added an answer Well, I figured out myself that running the profiler from… May 11, 2026 at 9:24 pm
  • Editorial Team
    Editorial Team added an answer Implement the __call method in your controller. This is the… May 11, 2026 at 9:24 pm

Related Questions

I am using PHP, jQuery, and JSON. Now I need to know how to
I am stumped with this problem. ActiveSupport::JSON defines to_json on various core objects and
Okay, my situation is such: I need to send the contents of a JavaScript
I am trying to parse JSON in an Adobe Flex app, using http://www.mikechambers.com/blog/2006/03/28/tutorial-using-json-with-flex-2-and-actionscript-3/'>This Tutorial

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.