saseow
Posts: 744
|
| Posted: 10/14/2008, 9:13 AM |
|
I am trying to show a greeting for the user on a page. e.g. 'Hello Trevor'.
I have put a label on the page and in the Before Show event of the label I have the following code:
$db = new clsDBhockey_stats();
global $f_name;
$sql= "select * from users WHERE ID = ".CCGetUserID();
$db->query($sql);
$db->next_record();
$f_name = $db->f("first_name");
$Container->$greeting->SetValue($f_name);
$db->close();
I get this error:
Catchable fatal error: Object of class clsControl could not be converted to string in
Any ideas?
Thanks.
|
 |
 |
saseow
Posts: 744
|
| Posted: 10/14/2008, 9:16 AM |
|
No worries, I got it:
$greeting->SetValue($f_name);
|
 |
 |
codebang
Posts: 74
|
| Posted: 11/14/2008, 7:57 AM |
|
Hello,
I really need to know what exactly was your error as i am working in the same issue.
I exactly have the same code you have written.
Thank you,
Salah Midhat.
|
 |
 |
saseow
Posts: 744
|
| Posted: 11/14/2008, 8:15 AM |
|
Hi,
I placed a label on the page and in the Before Show event added the following custom code:
$db = new clsDByour_database();
global $f_name;
$sql= "select * from users_table WHERE ID = ".CCGetUserID();
$db->query($sql);
$db->next_record();
$f_name = $db->f("first_name");
$greeting->SetValue("Hello ".$f_name. ", nice of you to join us!");
$db->close();
And thats it.
|
 |
 |
codebang
Posts: 74
|
| Posted: 11/14/2008, 10:09 AM |
|
im sorry....
it doesnt work..
Call to a member function SetValue()on a non object,, is the error..
any ideas..
thank you
|
 |
 |
saseow
Posts: 744
|
| Posted: 11/14/2008, 10:23 AM |
|
Make sure that the label that you put on the page has the name 'greeting' or change the code to the name that you have given the label.
If the label is not in a form then this should work perfectly. If it is in a form. then use the syntax $Container->etc.etc.
|
 |
 |
codebang
Posts: 74
|
| Posted: 11/14/2008, 10:28 AM |
|
Thanks so much. you made my day...
thank you .
Salah Hafiz
|
 |
 |
mamboBROWN
Posts: 1713
|
| Posted: 11/16/2008, 7:31 AM |
|
saseow
Can you please add [SOLVED] or [RESOLVED] to your thread title. Thanks in advance.
|
 |
 |