You are here: Re: Fatal error: Call to a member function on a non-object « All PHP « IT news, forums, messages
Re: Fatal error: Call to a member function on a non-object

Posted by laredotornado@zipmail.com on 03/01/07 22:17

On Mar 1, 3:54 pm, "Steve" <no....@example.com> wrote:
> | Thanks again but I can't see any difference when I print out the
> | array. Here's my code
> |
> | print "*****************<BR>\n";
> | $item1 = new CUserTOCItem(7,
> | "",
> | "ROOT",
> | 0,
> | 0,
> | 1,
> | 0);
> | $item2 = new CUserTOCItem(4,
> | "",
> | "Chapter 1",
> | 0,
> | 0,
> | 1,
> | 0);
> | $a = array();
> | $a[7] = &$item1;
> | $a[4] = $item2;
> | print_r($a) . "<BR>\n";
> | print "*****************<BR>\n";
> |
> | and the output
> |
> | Array ( [7] => cusertocitem Object ( [m_id] => 7 [m_parent] =>
> | [m_title] => ROOT [m_depth] => 0 [m_hidden] => 0 [m_open] => 1
> | [m_order_id] => 0 [m_children_arr] => Array ( ) ) [4] => cusertocitem
> | Object ( [m_id] => 4 [m_parent] => [m_title] => Chapter 1 [m_depth] =>
> | 0 [m_hidden] => 0 [m_open] => 1 [m_order_id] => 0 [m_children_arr] =>
> | Array ( ) ) )
>
> dave, you've changed your analogy. go back to creating new obj. directly to
> an array element. what was the *exact* output of the code *i* gave you to
> run?

To answer your question, I got

Array ( [0] => cusertocitem Object ( [m_id] => 7 [m_parent] => 0
[m_title] => ROOT [m_depth] => 0 [m_hidden] => 0 [m_open] => 1
[m_order_id] => 0 [m_children_arr] => Array ( ) ) [1] => cusertocitem
Object ( [m_id] => 4 [m_parent] => 0 [m_title] => Chapter 1 [m_depth]
=> 0 [m_hidden] => 0 [m_open] => 1 [m_order_id] => 0 [m_children_arr]
=> Array ( ) ) ) *****************

for this code (analogous to what you suggested)

$item1 = new CUserTOCItem(7,
0,
"ROOT",
0,
0,
1,
0);
$item2 = new CUserTOCItem(4,
0,
"Chapter 1",
0,
0,
1,
0);

-

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация