From: Daniel K. <dk...@ny...> - 2004-07-09 07:05:50
|
I came up with a work around in PHP instead of Flash. I am doing this in php: $rows = array(); $rowss = array(); $rs = mysql_query($query); while($row = mysql_fetch_array($rs,MYSQL_ASSOC)){ foreach($row as $key => $value) { $rows[] = $value; $rowss[] = $key; } } $results = array_merge($rows, $rowss); return $results; in Flash: function doPost_Result(result) { z = result.length/2; for (i=0; i<z; i++) { listBox.addItem(result[i], result[z+i]); } } This ends up giving me the value as the label in my list component, and the key as the data. I just wanted to give a big thanks to those who wrote amfphp as well as those who helped me. This definitely makes things a lot easier and faster. Dan -----Original Message----- From: amf...@li... [mailto:amf...@li...] On Behalf Of Mario Falomir Sent: Monday, July 05, 2004 9:45 PM To: amf...@li... Subject: RE: [amfphp] MYSQL_ASSOC problem You can have something like return mysql_query($yourQuery); or $rs = mysql_query($yourQuery); while($row = mysql_fetch_assoc($rs)){ $rows[] = $row; } return $rows; There are other ways but this could give you an idea :) >From: "Daniel Kantor" <dk...@ny...> >Reply-To: amf...@li... >To: <amf...@li...> >Subject: [amfphp] MYSQL_ASSOC problem >Date: Mon, 5 Jul 2004 20:44:17 -0400 > >Hi, > >I am new to remoting and am stuck on some code. I am doing a mySQL >query and returning the results into Flash. When I fetch the array like >this in PHP (with MYSQL_NUM): > >while ($row = @mysql_fetch_array($result,MYSQL_NUM)) > >I get this: > >Got result "Blues,Chill,Classic >Rock,Dub,Hip-Hop,Jazz,Live,Rap,Reggae,Rock" of type object which >contained the following: > 9: Rock > 8: Reggae > 7: Rap > 6: Live > 5: Jazz > 4: Hip-Hop > 3: Dub > 2: Classic Rock > 1: Chill > 0: Blues > > >When I switch it to this (MYSQL_ASSOC): > >while ($row = @mysql_fetch_array($result,MYSQL_ASSOC)) > > >I get this: > >Got result "[object Object],[object Object],[object Object],[object >Object],[object Object],[object Object],[object Object],[object >Object],[object Object],[object Object]" of type object which contained >the following: > 9: [object Object] > 8: [object Object] > 7: [object Object] > 6: [object Object] > 5: [object Object] > 4: [object Object] > 3: [object Object] > 2: [object Object] > 1: [object Object] > 0: [object Object] > >if I do MYSQL_BOTH, I get this: > >Got result "Blues,Chill,Classic >Rock,Dub,Hip-Hop,Jazz,Live,Rap,Reggae,Rock" of type object which >contained the following: > 9: Rock > 8: Reggae > 7: Rap > 6: Live > 5: Jazz > 4: Hip-Hop > 3: Dub > 2: Classic Rock > 1: Chill > 0: Blues > > >Does anyone know why I cannot return a MYSQL_ASSOC? It seems weird that >BOTH and NUM work but not ASSOC. > >Thanks, > >Dan > _____ The new MSN 8: <http://g.msn.com/8HMAEN/2737??PS=47575> smart spam protection and 2 months FREE* ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ amfphp-general mailing list amf...@li... https://lists.sourceforge.net/lists/listinfo/amfphp-general |