Jump to content

Arrays


mrjonnytou

Recommended Posts

Hi, I have been using queries to extract data from a mysql table and using a foreach loop to pull out the information from each row returned so that i can display it. This works fine. Some of the queries though will only return a single row (i.e. there is only one row in the table) and i would like to access the information returned from the query without using a foreach loop. So far I keep getting errors. For example:

 

The array returned from the query looks like this:

 

object(Zend_Db_Table_Rowset)[57]

  protected '_data' =>

    array

      0 =>

        array

          'id' => string '1' (length=1)

          'introduction' => string '<p>This Team Development Plan outlines the priorities of the IT Department in the short, medium and long term. It has been developed following consultation with management, customers and IT team staff.</p>

 

<p>Items planned for completion in the short term (0-6 months) detail the team's current priorities and tasks that we will be working on. These tasks should be the subject of detailed specification documented elsewhere which has allowed us to estimate resource requirements and include them into the team''... (length=1767)

  protected '_table' =>

etc...

 

 

and i have been trying the get at the value using:

 

$introduction[0]['introduction'];

 

but getting the error:

 

Fatal error: Cannot use object of type Zend_Db_Table_Rowset as array in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\tdp\application\views\scripts\index\introduction.phtml on line 3

 

Any ideas?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/120163-arrays/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.