My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
FlexDBTutorial  

Featured
Updated Feb 4, 2010 by gha...@gmail.com

Take a look at AS3FlexDB Tutorial 1 tutorial from iTutorials.ro

Simple example

All you need to load a table (for ex. "users") into a datagrid after you have install amfphp and set "services-config.xml" correctly is :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
	layout="vertical"
	xmlns:phi="phi.db.*"
	xmlns:mx="http://www.adobe.com/2006/mxml">

	<mx:DataGrid
		id="dg1"
		width="100%"
		height="100%"
		dataProvider="{q1.Records}">
		<mx:columns>
			<mx:DataGridColumn dataField="fname" headerText="First Name"/>
			<mx:DataGridColumn dataField="lname" headerText="Last Name"/>
			<mx:DataGridColumn dataField="password" headerText="Password"/>
		</mx:columns>
	</mx:DataGrid>
	
	<phi:ConnectionData id="c1" name="mxml_conn1" host="localhost" db="test" username="root" password="root" />
	<phi:Database id="db1" connection="{c1}" />
	<phi:Query id="q1" database="{db1}" q="SELECT * FROM users WHERE 1" />
	<phi:QueryExecute id="q1ex" query="{q1}" />
</mx:Application>

Table structures is:

CREATE TABLE `users` (
  `id` int(5) NOT NULL auto_increment,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `fname` varchar(255) NOT NULL,
  `lname` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;
Comment by Hassan...@lesieur-cristal.co.ma, Apr 8, 2009

good

Comment by ngotancuonglongan@gmail.com, Jun 7, 2009

so cool. I just try it. very great!. thanks so much!!!!

Comment by ngotancuonglongan@gmail.com, Jun 7, 2009
<phi:ConnectionData id="c1" name="mxml_conn1" host="localhost" db="test" username="root" password="root" />

when i change "localhost" to other word (ex: 'cuong'), it not work. althought i create Privilages (ex: 'cuong' full control) in Mysql

please help me! thanks.

Comment by wmk...@gmail.com, Jul 3, 2009

i have the problem above too. please help!

Comment by jasonvil...@gmail.com, Aug 18, 2009

Running Flex 3. As soon as the example runs, I get this:

Error: A connection with the same name exist!

at phi.db::Database/connect()[D:\Projects\Projects Flex\FlexDB\src\phi\db\Database.as:103] at phi.db::Database/set connection()[D:\Projects\Projects Flex\FlexDB\src\phi\db\Database.as:109] at mx.binding::Binding/defaultDestFunc()[E:\dev\beta1\frameworks\projects\framework\src\mx\binding\Binding.as:262] at Function/http://adobe.com/AS3/2006/builtin::call() at mx.binding::Binding/innerExecute()[E:\dev\beta1\frameworks\projects\framework\src\mx\binding\Binding.as:458] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.binding::Binding/wrapFunctionCall()[E:\dev\beta1\frameworks\projects\framework\src\mx\binding\Binding.as:370] at mx.binding::Binding/execute()[E:\dev\beta1\frameworks\projects\framework\src\mx\binding\Binding.as:306] at FlexDBExample()[/Users/villmer/Documents/Flex Builder 3/FlexDBExample/src/FlexDBExample.mxml:5] at FlexDBExample_mx_managers_SystemManager?/create() at mx.managers::SystemManager?/initializeTopLevelWindow()[E:\dev\beta1\frameworks\projects\framework\src\mx\managers\SystemManager?.as:3581] at mx.managers::SystemManager?/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[E:\dev\beta1\frameworks\projects\framework\src\mx\managers\SystemManager.as:3400] at mx.managers::SystemManager?/docFrameListener()[E:\dev\beta1\frameworks\projects\framework\src\mx\managers\SystemManager?.as:3258]

Comment by tugrultu...@gmail.com, Dec 10, 2009

Hi everyone. I have a little problem. :) as3flexdb is working good. But when I try to execute "select" query, modal loading screen comes to screen. How do I ignore(discard) this pop -up? Any idea ?

Thanks.

Comment by magg...@gmail.com, Nov 13, 2010

can it be that there has been some refactoring etc.? i can't seem to find the interfaces Iquery and IDatabase... wierd! i followed the tutorial, the SWC imports perfectly (i don't get errors at the import statements etc.) but it can't find the interfaces. also, with code completion, the SWC has a different package structure:

NOT WORKING: import phi.interfaces.IDatabase; import phi.interfaces.IQuery;

WORKING: import phi.framework.sql.;

halp?

Comment by neo.1...@gmail.com, Apr 18, 2011

Hi, it's not working in my computer. There is an error -> A connection with the same name exist!

Pls help. Thanks.

Comment by Blazerhe...@bol.com.br, Oct 6, 2011

Please help me

fault=[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://localhost/amfphp/gateway.php'"? messageId="7629FDAB-2473-4C38-C96D-D958422F85C9?" type="fault" bubbles=false cancelable=true eventPhase=2]

at phi.db::Query/onQueryFault()[D:\Projects\Projects Flex\FlexDB\src\phi\db\Query.as:505] at flash.events::EventDispatcher?/dispatchEventFunction() at flash.events::EventDispatcher?/dispatchEvent() at mx.rpc::AbstractOperation?/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:198] at mx.rpc::AbstractInvoker?/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:222] at mx.rpc::Responder/fault()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:53] at mx.rpc::AsyncRequest?/fault()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest?.as:103] at mx.messaging::ChannelSet?/faultPendingSends()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messaging\ChannelSet?.as:1482] at mx.messaging::ChannelSet?/channelFaultHandler()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messaging\ChannelSet?.as:975] at flash.events::EventDispatcher?/dispatchEventFunction()


Sign in to add a comment
Powered by Google Project Hosting