How to get specific integer value from array?

Here is the code

$db = JFactory::getDBO();
$query = "SELECT order_id FROM orders WHERE customer_number = '".$i."' AND created_on = '".$date."'";
$db->setQuery($query);
$rows = $dbz->loadObjectList();
print_r($rows);

The output is
Array ( [0] => stdClass Object ( [virtuemart_order_id] => 549 ) )

Read More

I want to get only 549 as output? What is the possible solution.

Note foreach() doesn’t work for me.

Related posts

Leave a Reply

2 comments

  1. You should probably use another function to load your data. Like:

    $db = JFactory::getDBO();
    $query = "SELECT order_id FROM orders WHERE customer_number = '".$i."' AND created_on = '".$date."'";
    $db->setQuery($query);
    $order_id = $dbz->loadResult();
    echo $order_id; 
    

    Check the joomla API documentation to find the right API-calls depending on what you need to do: http://api.joomla.org/cms-2.5/classes/JDatabase.html