2

i'm doing

$sql = $_SESSION['data']->bySQL("SELECT * FROM worlds WHERE field='shippingLicenseItemName'");

and then printing result(i know it is very simple but i'm learning by myself through this site)

echo nl2br(print_r($sql, true));

and in result i'm getting array like this :

 Array
(
[atlantis] => Array
(
[shippingLicenseItemName] => pkg_atlantisXfer
)

[australia] => Array
(
[shippingLicenseItemName] => pkg_australiaXfer
)

[avalon] => Array
(
[shippingLicenseItemName] => pkg_avalonXfer
)
)

but i want the results like : World : "atlantis" and item : "shippingLicenseItemName" and code is : "pkg_atlantisxfer"

World : "australia" and item : "shippingLicenseItemName" and code is : "pkg_australiaxfer"

1 Answer 1

1

Don't know where you found the bySQL property, it seems to be returning the data keyed by a column on its own, making things a tad more complicated.

But i'ts nothing you cannot solve with a couple of loops :

foreach($sql as $o_key=>$o_data) {
   foreach($o_data as $i_key=>$i_data) {
     print "World $o_key and item : $i_key and code is $i_data <br />"l
   }
}
Sign up to request clarification or add additional context in comments.

1 Comment

thank a bunch ^_^ hexblot. i was thinking to use foreach but every time get stuck on second loop where you use $o_data as $i_key =>$i_data . thank once again. i also know there is another method to perform that function is something like : $vSQL .= "SELECT * FROM worlds WHERE field='shippingLicenseItemName' " ; $vReturn = @$_SESSION['data']->bySQL($vSQL); $vResult = array(); But i don't know much about it

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.