adam291086 Posted March 10, 2009 Share Posted March 10, 2009 i am using ez_sql.php from php classes and i have it printing out this stdClass Object ( [idUser] => 1 [username] => adam [password] => plowman [title] => [forename1] => adam [forename2] => [surname] => plowman [addressLine1] => [addressLine2] => [town] => [postcode] => => [secondEmail] => [personalUrl] => [photo] => GIF89a00÷ÿ4Çõj“êÿè¦ä¸Ðÿæ ÿõ7š·vúýúwÅnÖåºE¦˜rçÿô)'uÂÏ·G-±óÇú3zæúõÐv¦ëmP´ô:¤ƒWX¸ÌÈfn•¶†¯×´êÿô·I†Õz¦YPˆ0K¦5FÏô²ß²—ÜþèI¹ùÆó³Å¦«ÉÊ^±´þõ•¨÷S±D¾ä½˜çýñZØÆ΄éѲ.øoÀf0”ÏvËÿî$ÿñ¦Ù£vчã¸í[‰Îˆ‘»ÞgÂfÊÙy×î×£¼‹ÿØz؈¬î\z物vÌéËÔÕÓõÎÿÑÊÕšµïÿõW4“‚óýåRýòFÅêq£Õþö†âóâ‹ușԗ”öÿéf*š_ŠæÉy§ð5‹—ìF\êzå;—ÌŒJ†å9¶1ƒwç°²Hl脪j@ÛÍÐÊEÆìä²Í}6} d;=žì÷ë"šíß_¨Çìþô£âé§×êÍló“ðææ—ÿöh“´y¾ó1§%ÿß .¨2UîÑü»É³0›ÿ÷v¢¾Ñÿì<*Œ®Â£,“*‚u§LQIøCxêE}(!’¨êæët\Ä#Z–ãñé–<àæW¹È%ÍÞà×à@Ÿé‹_~ö,pl¸\àîÖ°âÂB¡%ÿá4 ªô7 ëèŠaâÙÜjoÚmäcóåíáÏ‹\£ûŒ×÷‡åþb“Fããj~“ï„îÞä„ñØjžDïî=!’œ l) èõäF•¹0™ ¥íF€ùL˜ñÔÔÔ!ùÿ,00ÿÿ H°à@™Bà9Áð'0tœH±âÀI´þH ÃfS©¥6m¢##‰SÌÄI›RcÆ8󖢦7oø6l@A‰I*UNâ“ÌmC¨äKÀ´iqj”âéçÊ «0r9Æ[1MÊeJeÛ+ž ˜a%¨c^Ñ}q%D·n |vë2m²m'<½ÖFP'”7 ò‰YÌx±âÆéÆ9늓ž “‡JÑ$_“Ï A[ºt“@C(·»lQaMál4¡B»víѸÙÞÍ-ÝÎ'RÕ$¨È“#_@¢¹s‡”K?Tl§«{ÁÙª†àÃ+ÿSÆüùsC+”…ocH½ ®\©5CÂ4 Ô Â¿ÿC…(à€…‚Lþñ‡L Ø ð ¬DÔ‚Ø“NbØ̧Ìàᇅ|øá)C4“!†CƒÍoSÃvø-“ÎŒHÔHÀ*8†¡H–$á£%(Ž«0Qã‘é(ÐÀ¢rÕ?œ°AIŒjTY%»ì²ˆ"–\àå—_Æ N%Y2ae•>4ÐÀNG0r‘}hÒ€=>(P'9gœ±`˜ÀŸ€j X,’§;jÔ©@ j2y(U¤Ý}r6PC1¬’§øcJiH!ê¨R¤À Xh‘ç ¬ãƒ#j†ÿ²ÁGd"ÐRÆ)ç2³tá«LÈ!Ç'wÜáƱnØbK±RkŠ;^øÚÅ,5ØcO²"pv:Ø7¥œöðM-xÑBŸ`£î;ï@c‹‘,{Ç'rT`‡¹ä¶@œ‚â( ÿdÂÆS6 O<ÒÂ%ÄS`±Ü$pH–@6‘œóI?cÀ%—|ó„4௶¸èÂÀ”4ÐÉ- ÃrÁŸ¦¾…%ÑôB@vóI+uü‚#ðÈV€€ƒGÀ€š q€5 „ôüP‡9´¢ËÙgŸÓÏ„`Ñ3QT`Ž>^< DN?qÅ¡8ÿÈ'ÐaÌW\ñˆÍ_a $ýË/ˆ<9"ˆô£N0`ƒ?DÐc·äm…¥,QB'ÀáAá {ÄäbÎopa»:=#L¶sA1=$ÑGIHû×<]¸®”ÀHà[_Ñúë°çBÄ;ì`†žcÆ1x¿ýö;ä‘ :ÃÀþ@Éë½÷ή ·^@¯0Ù·AÃÿ4hÀ¡þÂðDèaØ yWˆš¶N‡:lA@Ø#?ècm‡Œà‚ °„%Ì &p7È€iëkß-:Á$ø9!%q€éÁHxCÿÖÑPàˆÉ`Çè‚,à;èCÙ÷4”QÚªZ&8@0@„{ 0L.€ ( ‰6&ã/x&ІxÁT|Â4 @`±µÐA·×Ç/‚@üaÚ Š,¬±|c2TÐQ´AŠì+€<0‡N0€›€ÀþÑÁy‘H…9F´! € T ÉI¾ Fh/:Y¡ðäTìüƒ›`Ã);L%ˆÀfAð‚h#Ì2q| Œpð™ô” „`2®à@ ` IøÁ”¨$'€ðL¯yÜt²ÉÿÍ,L x 0Orv¥€(#N@^æ<÷ÝVtÐŽ`B{ÈA9à‘ÿþ÷Âî%°v÷‰ ¨s ^Kœà h"‡àAáD¸8,v€9Lßà"k1ˆ0ð [postcodeStart] => [authorityToWorkStatement] => [contactPreference] => [EducationLevels_idEducationLevel] => [noOfGcses] => 0 [gcseEnglishGrade] => [gcseMathsGrade] => [fiveOrMoreGcses] => [noOfAlevels] => 0 [ucasPoints] => 0 [studentStatus] => [mobile] => [landline] => [dob] => [penaltyPoints] => ) which is the correct data. I need to turn that stdclass object into an associative array i.e $data =array([username] => adam) how can i go about this? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted March 10, 2009 Share Posted March 10, 2009 To access variables within the stdClass you can use $data->var_name However if you want convert the stdClass to an array you can do $data = (array) $data; //OR $data = get_object_vars($data); Quote Link to comment Share on other sites More sharing options...
adam291086 Posted March 10, 2009 Author Share Posted March 10, 2009 wonderful, Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.