GetObjectList woe

23 views
Skip to first unread message

ae0...@gmail.com

unread,
Jan 19, 2006, 2:04:32 AM1/19/06
to Php Object Generator
Hi there

I stumbled across POG and love it - great skills guys.

i'm having trouble accessing the properties returned from the
GetObjectList.
the examples in the tutorial were for the old method of GetList and do
not appear to be working for me:

this is my code:

$su = new Su(); //create a book object
$suList = $su->GetSuList('suId', '>', 0);

foreach ($suList as $su){
echo ('<br/>');
echo ('<br/>suLogin:'.$su->suLogin );
echo ('<br/>su:'.$su );
echo ('<br/>su serialised: '. serialize($su));

}

This is the result:

suLogin:
su:Object id #1
su serialised:
O:2:"Su":6:{s:4:"suId";N;s:7:"suLogin";N;s:10:"suPassword";N;s:10:"suRealName";N;s:7:"suEmail";N;s:12:"lastLoggedIn";N;}

suLogin:
su:Object id #2
su serialised:
O:2:"Su":6:{s:4:"suId";N;s:7:"suLogin";N;s:10:"suPassword";N;s:10:"suRealName";N;s:7:"suEmail";N;s:12:"lastLoggedIn";N;}


all i would like to do is be able to echo out the properties of 'su'.

any ideas?

thanks

andrew

Joel

unread,
Jan 19, 2006, 10:23:28 AM1/19/06
to Php Object Generator
Hi Andrew,

try
$su = new Su();


$suList = $su->GetSuList('suId', '>', 0);

foreach ($suList as $su){
echo ('<br/>');

print_r($su);
echo ('<br/>');
}
This will print out all the attributes of each objects.


I don't see anything wrong with the code sample you sent. echo $su and
echo serialized $su seem to work. It's only the suLogin which seems to
be empty. Maybe it's empty in the database as well. Take a look at
your mysql db and see if the values have been set there.

Hope this helps, Please let us know.

ae

unread,
Jan 19, 2006, 5:35:37 PM1/19/06
to Php Object Generator
Hi Joel - i appreciate your help with this. I'm coming to PHP from
other languages and I'm still picking up the subtle differences.

I double checked the DB and the fields all have valid values (entered
via POG).

However when i implemented POG i had exisiting tables so did not
recreate the databases but tried to realign fields etc. (can you guess
where this is going??)

Anyway my fields were capitalised like this: suLogin
But in the 'Get' function they were capitalised like this: sulogin
This meant that although the results were being returned, I wasn't
grabbing them from the row :)

mySQL didn't care about capitalisation yet PHP did :)

*sigh*

so thanks for your help - hopefully someone else can save a few hours
by reading this post and checking capitalisation in db fields.

Cheers

andrew

Joel

unread,
Jan 19, 2006, 9:26:16 PM1/19/06
to Php Object Generator
Hey Andrew,

glad you were able to solve it.

Joel

Reply all
Reply to author
Forward
0 new messages