Invenzzia »

Pages: [1]   Go Down
  Print  
Author Topic: OPTv2: Load items to a seccion  (Read 683 times)
Description: How the array that has the data need to be
0 Members and 1 Guest are viewing this topic.
amichelin
User

Offline Offline

Posts: 10


View Profile
« on: April 28, 2009, 15:54:53 »

Hi
In the docs has an example with this array

Code:
array(0 =>
    array('author' => 'John', 'date' => 'Mar 13 2009', 'body' => 'Nice article!'),
    array('author' => 'Adam', 'date' => 'Mar 15 2009', 'body' => 'Thanks a lot, it was very helpful'),
    array('author' => 'Susan', 'date' => 'Mar 17 2009', 'body' => 'One small suggestion... '),
);

This printed is :

Code:
Array
(
    [0] => Array
        (
            [author] => John
            [date] => Mar 13 2009
            [body] => Nice article!
        )

    [1] => Array
        (
            [author] => Adam
            [date] => Mar 15 2009
            [body] => Thanks a lot, it was very helpful
        )

    [2] => Array
        (
            [author] => Susan
            [date] => Mar 17 2009
            [body] => One small suggestion...
        )

)

The dos says"By default, the section items must be enumerated from 0 and the indices must not contain any holes, like 3, 4, 6. Using a database row index is a bad choice."

What is the problem with a array numbered?

I need some code like this :

Code:
$a = array();
    while ( !$rs->EOF )
    {
        $a[] = $rs->fields;
        $rs->MoveNext();
    }

Leting php auto numeber the array?

Thanks in advance
« Last Edit: April 28, 2009, 16:46:09 by eXtreme » Logged
eXtreme
Invenzzia
Administrator
User
*****
Offline Offline

Posts: 129

Jacek Jędrzejewski


View Profile WWW
« Reply #1 on: April 28, 2009, 16:50:46 »

I don't understand your problem. The code you provided is OK and will generate a correct array for OPT. Autonumbering is a correct solution. Wouldn't it be faster to make a test code and check if everything is ok? ;)

PS. Please, use "code" bbcode tag to make your code fragments readable. I've edited your post to add this tag.
Logged

amichelin
User

Offline Offline

Posts: 10


View Profile
« Reply #2 on: April 28, 2009, 19:31:51 »

Thanks for the help

The ORM that i am using generate a array compatible wiht OPT simplify the work.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Subject Started by Replies Views Last post
abercrombie outlet, seismic design and construction of hard galardef 0 11 Last post May 08, 2012, 03:33:21
by galardef
OPT: include doesn't work wimg 9 3341 Last post March 26, 2008, 14:12:43
by Zyx
OPTv2: Problem po wyłączeniu konsoli chordspl 2 483 Last post July 06, 2011, 13:31:08
by chordspl
OPTv2: How to load a template file for other folder than the configured amichelin 2 742 Last post April 28, 2009, 20:18:34
by amichelin
OPL: power loader 3/terms of use mikakun 0 166 Last post November 22, 2011, 13:42:52
by mikakun