Let's query it from flex !

Well, now we have everything configured, we can start coding.

In our main app's declarations, let's add a SqlQuery component, like this :


<core:SqlQuery id="qUsers" sql="Select * from users"/>

As you can guess, this object will allow us to retrieve all the users from our table.

In the script section, we override the createChildren() method :

			import org.flexqueries2.utils.logging.Logger;
			
			override protected function createChildren():void
			{
				SqlQuery.serviceUrl = "http://localhost/flexqueries-2.0/svn/php/flexqueries2/www/fc.php";
				
				super.createChildren();

				Logger.show();
				//Run the select asynchronously:
				qUsers.selectAsync();
			}

Notice you have to adapt the line 5 for your configuration. It has to target the fc.php file in your Flexqueries www directory.

The Logger.show() will display a logging window, and thanks to it we'll see if our environment works.

You should see the following 3 lines in the logger :

selectAsync : Select * from users

rows received

4 rows

If not, check your environment or post a comment for help.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <pre>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.