Solved

AS3 and database [ SQL vs MYSQL ]

Posted on 2011-03-16
11
810 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

863 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

26 Experts available now in Live!

Get 1:1 Help Now