Solved

AS3 and database [ SQL vs MYSQL ]

Posted on 2011-03-16
11
850 Views
Last Modified: 2012-05-11
I was wondering if working with SQL server is different than working with MYSQL.
If it is, how do I connect to a SQL server and read and write to it.

0
Comment
Question by:Angha110
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
11 Comments
 
LVL 29

Expert Comment

by:dgofman
ID: 35151458
From end user and Flex Developers no diffrences you are using MSSQL or MySQL or DB2 or Oracle ect.
0
 

Author Comment

by:Angha110
ID: 35151625
So, I should do the same with the SQL server connection as I do for mysql?
0
 
LVL 29

Expert Comment

by:dgofman
ID: 35151649
You are not connecting to the databse you have to create HTTP connection to your server.
Using RemoteObject (AMF), WebService (SOAP), XMLSocket etc. And on backend implements a database communication.
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Author Comment

by:Angha110
ID: 35151727
I have been using PHP to access MYSQL and that is the only way I know how,
Could I do the same?
0
 
LVL 29

Expert Comment

by:dgofman
ID: 35151940
0
 
LVL 29

Expert Comment

by:dgofman
ID: 35151951
If you will get access to MySQL in PHP should can transfer data over the internet using AMF, XML or JSON format
0
 

Author Comment

by:Angha110
ID: 35151952
XML
0
 
LVL 29

Expert Comment

by:dgofman
ID: 35151983
In this case connect to MySQL
Run query: mysql -uroot --xml -e 'SELECT * FROM TABLE'
(It will generate XML output)
Send this result to the client using HTTP connection
and on the client side convert string to XML
var xml:XML = new XML(str);
0
 
LVL 29

Expert Comment

by:dgofman
ID: 35152014
or you can get result set and create your output.

Example:

http://devzone.zend.com/article/11
0
 

Author Comment

by:Angha110
ID: 35152216
In this case connect to MySQL
Run query: mysql -uroot --xml -e 'SELECT * FROM TABLE'
(It will generate XML output)
Send this result to the client using HTTP connection
and on the client side convert string to XML
var xml:XML = new XML(str);

Open in new window


Will you please open this up for me, a little more details so I can do it in my Flash project.

Thanks,
0
 
LVL 29

Accepted Solution

by:
dgofman earned 500 total points
ID: 35153785
You can use at least 10 options retrieve data in PHP using MySQL connection.

For example using this library:

http://www.tonymarston.net/php-mysql/dom.html

or simply create a SQL query (what I used in the past, to avoid marshaling data via result set)

SELECT GROUP_CONCAT('<timezone id="', Time_zone_id, '" offset="', Offset , '" code="', Abbreviation,'"></timezone>' SEPARATOR '\n' ) AS xml FROM `time_zone_transition_type`

And you will pass this string to the Flex on the Flex side using  mx:HTTPService  you will get result as string. You just need to convert to XMLList. “new XMLList(phpResult)”
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question