Solved

AS3 and database [ SQL vs MYSQL ]

Posted on 2011-03-16
11
806 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
  • 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
 

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now