0

私はこのようなコードを持っています:

$user = JFactory::getUser();
$user_id= $user->get('id');

$db = JFactory::getDbo();
$db->setQuery("SELECT virtuemart_user_id, order_number, order_total, created_on FROM `kunkp_virtuemart_orders` WHERE `virtuemart_user_id`='$user_id' ");

$row = $db->loadRowList();

print_r($row);`

The output of the result is like this:


Array
(
    [0] => Array
        (
            [0] => 42
            [1] => 10e803
            [2] => 122.05487
            [3] => 2013-06-10 20:34:39
        )

    [1] => Array
    (
        [0] => 42
        [1] => 901e04
        [2] => 349.78500
        [3] => 2013-06-11 07:28:19
    )

)

Here, 10e803 & 901e04 is order number. I want to store all the order number in `$order_number` string & want to print the value of `$order_number` . How I can do that. I tried with foreach like this:

`foreach($row as $d){

    $order_number .= $d[1];
}
echo $order_number;

しかし、それは機能していません。誰でも私を助けてください。

4

1 に答える 1

1

これを交換して...

 `foreach($row as $d){

これとともに....

$order_number = "";   
 foreach($row as $val){
    $order_number.= ",".$val[1];
 }
echo $order_number;
于 2013-06-16T07:48:08.237 に答える