Returns an ArrayCollection from PHP collection
Hey everybody. I'm playing with the Flex RemoteObject class. I inserted with success of data in a database. Now, I try to recover the data and set the result as a dataProvider to a DataGrid component or list. I used Charles to check if I get all the data at all, and I found that everything works fine except that I'm getting a table and not an ArrayCollection collection. I tried casting the result inside Flex, but that did not work, makes it even DataGrid empty... any suggestions?
Here is my PHP function:
public void getUsers()
{
$sql = "SELECT * FROM USERS";
$res = mysql_query ($sql);
$params = array();
while ($row < mysql_fetch_array ($res))
{
$user = new VOUser;
id-> $user = $row ['id'];
$user-> name = $row ['name'];
$user-> name = $row ['name'];
$user-> email = $row ['email'];
$user-> password = $row ["password"];
-> company $user = $row ['company'];
$user-> phone = $row ["phone"];
$user-> fax = $row ['fax'];
$user-> job_position = $row ["job_position"];
$user-> Web site = $row ["Web site"];
$user-> vat_number = $row ["vat_number"];
$user--> ip_address = $row ["ip_address"];
$params [] = $user;
}
mysql_free_result ($res);
return $params;
}
While ($row = mysql_fetch_object ($result))
{
$tmp = new valueObject();
$tmp-> name = $row-> name;
etc...
etc...
[$processedResult] = $tmp;
}
Return $processedResult;
Tags: Flex
Similar Questions
-
How to return data from PHP form MySQL
I need to return data from a database MySQL, based on a simple form in a PHP page. The user will enter a zip code in a form and click a button to get all the records in a MySQL database that match the zip code entered by the user. I have configured MySQL database and I can return all records from a PHP page. What I have to do now is create the form and the code PHP to call the MySQL database. Can someone help me with how to do it?slpuyear wrote:
> My apologies for the confusion. Can I get back all the data in the dataset,
> However, I create a form to query the dataset object. I can do a simple
> HTML form, but do not know how the action of the form to query my dataset
> and return a subset of all data.Press F1 to open help for Dreamweaver. Go to develop Applications quickly
> Construction of the ColdFusion Applications rapidly > building search and results
pages (ColdFusion, ASP, JSP, PHP).--
Adobe Community Expert David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
Load directly from php as a DataProvider to a datagrid
Hello
The normal method to load data from php in one datgrid is pushing in and Board first...:
for (var i: uint = 0; i < event.target.data.dgRows; i ++)
{
dgArr.push
({
ID:event.target.data ["ID" + i],
dateLogged:event.target.data ["dateLogged" + i],
quoteNumber:event.target.data ["quoteNumber" + i],
clientPoNum:event.target.data ["clientPoNum" + i],
compName:event.target.data ["compName" + i],
exclusive: Event.Target.Data ["exclusive" + i]
Tax:event.target.data ["Tax" + i],
inclusive: Event.Target.Data ["Inclusive" + i]
});
}
DG1. DataProvider = new DataProvider (dgArr);
What I want to know is if it is possible to "event.target.data" directly as a dataprovider, tried but failed for obvious reasons: DG1.dataProvider = new DataProvider (event.target.data);
Basically I want the code that does not change for each php file and reduce the amount of lines of coding, for example. I want to "dynamic": eliminate\change
"for (var i: uint = 0;". I < event.target.data.dgRows;. i ++) {dgArr.push (...); »
Something like that would be great...
(var key: string in the map)
{
dgArr.push
({
key : [key] card
});
}
(the above code will add a line for each key that actually represent a column which is totally not what is necessary and is empty because the 'key' must indicate...)
Help will be appreciated
You can use the JSON native encoding of functions in PHP to wrap your results into an object that can use the native JSON functions in AS3 decoding turn around in a table that can be used as a dataProvider.
You can of course also write logic to wrap your results as XML from PHP and use it directly as a dataProvider.
Just to set the MIME type that is appropriate for what you want to send and use the string normal receive mode. for example return to XML format and myGrid.dataProvider = XML (e.target.data); or return JSON and myGrid.dataProvider = JSON.parse (e.target.data);
Edit:
Haha you never kglad of sleep...
-
remove items from a collection
Hi all
I have a record type, and I want to delete items, if second and third attribute of the current record is the same as an attribute of second and third the previous record. Here is an example:
declare type t_serv is record ( a varchar2(10), b varchar2(10), c number(5), d number(5) ); type t_serv_tab is table of t_serv; x t_serv_tab; begin x := new t_serv_tab(); x.extend; x(x.last).a := 'DSL'; x(x.last).b := 'ADSL'; x(x.last).c := 100; x(x.last).d := 20; x.extend; x(x.last).a := 'DSL'; x(x.last).b := 'ADSL'; x(x.last).c := null; x(x.last).d := 20; x.extend; x(x.last).a := 'IPTV'; x(x.last).b := 'N/A'; x(x.last).c := null; x(x.last).d := null; x.extend; x(x.last).a := 'CABLE'; x(x.last).b := 'CATV_FTTH'; x(x.last).c := 50; x(x.last).d := null; x.extend; x(x.last).a := 'DSL'; x(x.last).b := 'VDSL'; x(x.last).c := 100; x(x.last).d := 20; x.extend; x(x.last).a := 'DSL'; x(x.last).b := 'VDSL'; x(x.last).c := 100; x(x.last).d := null; -- in this case, elements from 2nd and 6th position are deleted, as they have similar "a" and "b" attributes as the previous record's "a" and "b" for i in x.first..x.last loop if i>1 then -- if I don't put this, I got an Subscript outside limit error if x(i).a = x(i-1).a and x(i).b = x(i-1).b then x.delete(i); end if; end if; end loop; -- print the final collection (should have 4 elements) for j in x.first..x.last loop dbms_output.put_line(x(j).a||', '||x(j).b||', '||x(j).c||', '||x(j).d); end loop; end;
The problem is that I'm me ORA - 01403 No. data found error. And I understand why, because the last loop, loops within all the elements, but the 2nd and 6th items from the collection are deleted before.
How can I solve this problem and to print the 4 remaining items?
Thank you!
The collections are rare objects, so unless you know collection has no deficiencies you should not use the LOOP for first time (before deletion) you know collection has no gaps, so you can use the FOR LOOP. However, since you remove elements, previous element of SEO via i - 1 is false, because I have element - 1 can be deleted. You must save the last element not removed. Now your impression share must assume at least an element has been removed and the collection is sparse (present gaps). Therefore, you must use LOOP, no LOOPS and use methods NEXT and LAST to iterate over the collection:
declare
type t_serv is (record
a varchar2 (10),
b varchar2 (10),
c number (5),
d number (5)
);
type t_serv_tab is table of the t_serv;
x t_serv_tab;
number of prev_i;
Start
x: = new t_serv_tab();
x.extend;
x (x.last) .to: = "READ";
x (x.last) .b: = "ADSL"
x (x.last) .c: = 100;
x (x.last) .d: = 20;
x.extend;
x (x.last) .to: = "READ";
x (x.last) .b: = "ADSL"
x (x.last) .c: = null;
x (x.last) .d: = 20;
x.extend;
x (x.last) .to: = 'IPTV ';
x (x.last) .b: = "n/a";
x (x.last) .c: = null;
x (x.last) .d: = null;
x.extend;
x (x.last) .to: = "CABLE."
x (x.last) .b: = "CATV_FTTH";
x (x.last) .c: = 50;
x (x.last) .d: = null;
x.extend;
x (x.last) .to: = "READ";
x (x.last) .b: = 'VDSL.
x (x.last) .c: = 100;
x (x.last) .d: = 20;
x.extend;
x (x.last) .to: = "READ";
x (x.last) .b: = 'VDSL.
x (x.last) .c: = 100;
x (x.last) .d: = null;
prev_i: = 1;
I'm looping 2.x.last
If x (i) (prev_i) .to .to = x and x (i) .b = x (prev_i) .b
then
x.Delete (i);
on the other
prev_i: = i;
end if;
end loop;
-print the final collection (must have 4 elements)
prev_i: = x.first;
loop
dbms_output.put_line (x (prev_i) .to | ',' | x (prev_i) .b | ',' | x (prev_i) .c | ',' | x (prev_i) .d);
When the output prev_i = x.last;
prev_i: = x.next (prev_i);
end loop;
end;
/
Scott@pdb1orcl12 > /.
DSL, ADSL, 100, 20
IPTV, N/A,
CABLE, CATV_FTTH, 50.
ADSL, VDSL, 100, 20PL/SQL procedure successfully completed.
SY.
-
How to move photos from one Collection to another Collection
Some, while the rear I hung some pictures from one Collection to another Collection.
Later, I noticed that I had lost the ability to edit images moved.
Please explain how can I move photos between Collections without causing problems?
Cliff
However, I can't figure out how to move photos from a private Collection to another more appropriate called Collection. I had thought that drag would do the trick. But I was wrong.
Well, I think it's the right way to do it. Why do you think it's wrong? What is going on? Describe in detail or show a screenshot. State of the edited, complete error messages, Word for Word.
-
Remove a photo from a collection - then automatically catalog.
Nobody knows: deleting a photo from a collection does not delete the photo from the catalogue. My goal is to remove a collection and at the same time to get the photos to delete in the catalog of all the photographs. Is this possible? Is someone enlighten us on how this is possible? Thank you very much!
Hi HillaryQ,
Yes, you can remove photos from the collection, which is also removed from the catalog as well at the same time.
Select the Images from the Collection
Press Alt + Backspace (Windows)
Press Alt + Del (Mac)
It will be useful.
~ Mohit
-
How can I fix my Lightroom 6? It starts and then crashes when I try to delete a photo from a collection or edit a photo.
Go to the dialog box Preferences, Performance tab and disable the GPU acceleration. See if that helps.
-
How to remove a photo from a collection and simultaneously remove the disc
I find that when I delete a photo from a collection that remains on my hard drive (Finder).
It's painful because I've deleted hundreds of photos and assumed they were being removed from my hard drive as well. Here are the pictures, I want more.
I know that if I delete a photo from my main library asks me if I want deleted from the disk as well.
But is there a way to delete a photo from a collection and removed it from the disk as at the same time?
In addition, now I have hundreds of photos on my hard drive that I thought I was unwanted remove when I deleted them from lightroom, is there a simple way to track those and delete them?
Thank you
But is there a way to delete a photo from a collection and removed it from the disk as at the same time?
Use the 'remove splat' Shift-Ctrl-Alt-Delete
You will be asked no confirmation. The files will be deleted immediately.
In addition, now I have hundreds of photos on my hard drive that I thought I was unwanted remove when I deleted them from lightroom, is there a simple way to track those and delete them?
Simple way? I'm not aware of anything.
Complexes of convoluted way? Perhaps, but I've never tried, so I would be guessing.
-
cannot switch from php to actionscript 3.0 variables
I use CS3 and I write the following code to pass the variable to Flash from PHP
ActionScript
var myLoader:URLLoader = new URLLoader();
myLoader.dataFormat = URLLoaderDataFormat.TEXT;
var myRequest:URLRequest = new URLRequest ("http://localhost/moodle/value.php");
myLoader.load (myRequest);
myLoader.addEventListener (Event.COMPLETE, onCompleteHandler);
var myValue: String;
function onCompleteHandler(e:Event):void {}
var $myvariable: URLVariables = new URLVariables (e.target.data);
myValue = myvariable.values;
trace (MyValue);
}
PHP file
<? PHP
ECHO ('values = 8');
? >
But I always have the error and can not get the values using trace();
Until I try to use 'myLoader.dataFormat = can;' I still get the same error.
: Error #2101: the string passed to URLVariables.Decode must be a query string URL-encoded containing name/value pairs
to Error$ /throwError)
at flash.net::URLVariables/decode()
at flash.net::URLVariables$iinit()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
Can someone help me?
Rewrite your PHP...
<>
echo "values = 8;
?>
edited: deleted information about different display
-
Problem passing variable from PHP to Flash
I'm moving a single variable from PHP to Flash. However, I can't quite make it work.
In a PHP file named data.php, I use:
"$query = SELECT SUM (Debt) As Total OF THE debtclock;
$result = mysql_query ($query);
$debt = mysql_result ($result, "Total");
Print "debttotal = $debt";
In Flash 8 Actionscript, I use:
loadVariables("data.php","0");
If I understand correctly, this should make the variable available in Flash debttotal.
Can someone tell me where I'm wrong?Try this:
loadVariables ("data.php", _level0);
The 2nd parameter specifies the target that receives variables, '0' is not a valid value for this. With _level0, variables will be found in the root timeline, so you can access it with _root.debttotal (from _level0) or _level0.debttotal (on a different level than _level0).Welcome,
blemmo -
Fill() return empty ArrayCollection collection
Hello
I'm new to SDS and do not know why the fill() method returns nothing, even if the assembler returns a list of 3 items. I know the list is back nothing because when I see the length of the ArrayConnection, it is 0.
I'm Tournai on the debugging logs and see the 3 items returned. Do you have tips on how I can solve this problem?
Is there somewhere in the configuration where I specify the Java class maps to ActionScript class B? I just deleted my corresponding ActionScript class and always the same newspapers. I suspect that the SDS does not know how to map the Java class in the ActionScript class so that it gives me an empty list and throws the results. Does this sound right? If there is some sort of automatic mapping, I was expecting to see an error in the log after I deleted the ActionScript class.
Thank you
Jamie
[Flex] 18/05/2007 12:19:31.443 [DEBUG] [DataService.Transaction] committed trans
action
[Flex] 18/05/2007 12:19:31.443 [DEBUG] [Message.Data.fill] after calling a service:
data service
answer: Flex Message (flex.data.messages.SequencedMessage)
sequenceId = 0
sequenceSize = 3
(no proxy sequence)
clientId = null
correlationId = null
destination = company
messageId = 7A2A0D8F-C32B-80BC-D593-4551B71320F1
timestamp = 1179515971443
timeToLive = 0
body =
[
Company (companyId = 100, name = null, address = null, status = null, zip = null undue
Try = null),
Company (companyId = 101, name = null, address = null, status = null, zip = null undue
Try = null),
Company (companyId = 102, name = null, address = null, status = null, zip = null undue
Try = null)
]I found the answer to my own question. It was just a race condition. You can not read the size of the ArrayCollection collection immediately. The list takes some time to complete.
-
adding all entries from one collection to another?
Hello
my database is a 11g
I have a function (in a box) than returnes a collection.
I want to call the function multiple times and the caller must combine all entries selected in a single collection (new?):
create or replace package my_test is procedure public_proc; end my_test; create or replace package body my_test is cursor test_data(selected_type varchar2) is select (1+ABS(MOD(dbms_random.random,100000))) as id, selected_type||level as my_value from dual connect by level<5; type my_type is table of test_data%row_type; function private_function(selected_type varchar2) return my_type is v_my_type my_type := my_type(); begin open test_data(selected_type=> selected_type); fetch test_data bulk collect into v_my_type; close test_data; return v_my_type; end private_function; procedure public_proc is v_my_type_a my_type := my_type(); v_my_type_b my_type := my_type(); v_my_type_ab my_type := my_type(); begin v_my_type_a := private_function(selected_type=>'A'); v_my_type_b := private_function(selected_type=>'B'); -- simplest solution to combine v_my_type_a and v_my_type_b to v_my_type_ab, possible without explicit loop? for i in v_my_type_ab.first..v_my_type_ab.last loop dbms_output.put_line('id: '||v_my_type_ab(i).id||', value:'||v_my_type_ab(i).my_value); end loop; end public_proc; end my_test;
desired output (x instead of random number):
id:x, value:A1 id:x, value:A2 id:x, value:A3 id:x, value:A4 id:x, value:B1 id:x, value:B2 id:x, value:B3 id:x, value:B4
Good bye
DPT
I can also do a big collect in against a collection of nested type?
OK – what a trick question?
You ask if you can do what the code you first published already does?
Hmmm - well, I'll say YES - since your code is already doing it.
What type of collection, exactly, do you think that you have agreed with this line?
type my_type is % row_type test_data table;
Of course, 'row_type' is not valid; It is % ROWTYPE.
If you are unsure what type of collection which is then I suggest that you only consider "with the help of the Collections of PL/SQL and Records" in the language PL/SQL doc
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm
He explained each of the collection types, explain how to choose one that suits and examples of their use.
DECLARE
cursor emp_data (my_job emp.job%type) is select *.
from emp where job = my_job;
type my_emp_data is table of the emp_data % rowtype;
my_emp_data v1.
my_emp_data v2.
my_emp_data v3;
BEGIN
Open emp_data ("REGISTRAR");
extraction emp_data bulk collect in v1;
close emp_data;
Open emp_data ("SELLER");
extraction emp_data bulk collect in v2;
close emp_data;
v3: = v1 v2 of MULTISET UNION;
for me in v3.first... loop v3. Last
dbms_output.put_line (v3 (i) .ename |) ' - ' || V3 (i) .job);
end loop;
END;
/
SMITH - CLERK
ADAMS - CLERK
JAMES - CLERK
MILLER - CLERK
ALLEN - SELLER
WARD - SELLER
MARTIN - SELLER
TURNER - SELLER
Also note that I do NOT use a query to combine collections:
v3: = v1 v2 of MULTISET UNION;
-
Modified files have disappeared from My Collections folder
I just spent the last hours 8 selection on a hundred photographs from more than 1000 images and placed them in a Collections folder, but as I take a few images in the Collections folder they all disappeared. Not sure what I did but I quickly press the cancel key, but they did not return. Can someone tell me please on how to get the images I had in my Collections return folder? Any help is appreciated...
Hi Nekten sorry for your frustration.
Unfortunately, you have discovered the behavior of collections or collections 'silly' as I like to call them.
They are little like cardboard for storage boxes - they do the job, but you have to decide what to remove and what to put in them.
If items are removed incorrectly then the only way for them to get back in is to pack them yourself - the items themselves have no innate knowledge where they are supposed to be.
So apart from again there is no solution here.
However, I have a better idea for you to consider.
Use the Smart collection.
Smart collections are filled according to the criteria you select.
These collections become self-referential - as long as an image contains the metadata set criteria, that it belongs to this collection.
Can not accidentally delete a picture from a Smart collection.
The most likely candidates for the inclusion criteria can be side to stars, labels color or key words, but all of the searchable metadata may be used as appropriate.
Tony Jay
-
How do root data from php file using local host in as3?
I really sowie coz my English are bad.now I want to the root of the phpfile use localhost in action script adobe flash pro... can u give me some example and explanation
I'm using json array data in my php
Your PHP returns JSON, right? Take a look at the URLLoader class in the documentation to know how to load the data from a URL. Once the data is loaded, you need to decode it to AS3 object. Use JSON of Mike Chambers' library https://github.com/mikechambers/as3corelib
--
Kenneth Kawamoto
-
order in a results set from of collection
Hello
given this query:
Select id from table where fieldname in (val_1, val_2,... val_n);
say anything of the order in the result set returned?
It will be the order of the collection (for example, the id for val_1), id val_2, etc.
or, if this is not guaranteed? (as with selects normal)
Thank youOracle does not guarantee the order in which the result set is returned, unless an explicit ORDER BY clause is mentioned.
Thank you
Knani
Maybe you are looking for
-
A few server contacts could not be copied to the address book of tis
Try to sync Yahoo Contacts (entrance on MacBook Pro, OSX 10.11.6) with the Mac Contacts Contacts/iCloud. On iCloud Contacts, a triangle indicates next to 'Yahoo' with the msg "some contacts server may not be copied in this address book.
-
After the update to iOS 9.3 my 2 Mini iPad fails to activate. I get the message 'wrong apple ID' all the time, even if its my correct apple ID, that works on iTunes and iCloud, etc.. I tried the activation via iTunes recovery mode and DFU mode, but n
-
Japanese police on the front panel does not
Hello I'm new on the use of LV and learns that when I hit a Japanese character, it indicates text of garbage. System: Windows 7 Pro 32 bit SP1 LabVIEW 2013 Problem: Whenever I touch in Japanese characters, the result is garbage, but when I tried to e
-
Executable, create additional folders for oscilloscope and Signal Analyzer
Hello world I am facing problem while creating executable. I use 8.x layout. I'm talking about signals and oscilloscope monitor in my application. When I create an executable of my application, I found in the target folder 2 additional folders with t
-
Issue at the start of Windows 7 when you set up windows update
Every time that turn on the computer (it is a VAIO laptop actually), Windows retains the configuration of updates but rest 0% as forever, after awhile, it says failed to update configuration every time then the computer works normally. Every time as