dzul
Posts: 5
|
| Posted: 06/02/2011, 1:43 AM |
|
hello all
i am newbie in php pgramming and new to codecharge..just wanna to know how too used CCDLookup function.
i tried to call a data from database and view it on label like this
$lokasi1 = CCDLookUp("nama_lokasi", "lokasi", "id_lokasi=". $DBmaklumat);
but i got error when publish
Catchable fatal error: Object of class clsDBmaklumat could not be converted to string in C:\xampp\htdocs\maklumat_hardware\respon_aduan_com_events.php on line 24
any one know?? sorry coz my bad english
|
 |
 |
rho
Posts: 85
|
| Posted: 06/02/2011, 1:52 AM |
|
Hi,
you have a syntax error in your statement: the id-variable is missing.
Try something like:
$lokasi1 = CCDLookUp("nama_lokasi", "lokasi", "id_lokasi=".$idlokasi, $DBmaklumat);
Cheers, Rob.
|
 |
 |
dzul
Posts: 5
|
| Posted: 06/02/2011, 2:03 AM |
|
thanks for reply rob but wanna to know $idlokasi its stand for what?sorry coz i try to get it..
|
 |
 |
rho
Posts: 85
|
| Posted: 06/02/2011, 2:08 AM |
|
Hi dzul,
$idlokasi is the variable that contains the value of the id_lokasi that you want to select from the table lokasi.
In other words: the CCDLookup() function selects the "nama_lokasi" value from the row in table "lokasi" where the "id_lokasi" field equals the value of the $idlokasi variable.
Rob.
|
 |
 |
dzul
Posts: 5
|
| Posted: 06/02/2011, 2:46 AM |
|
rob..can u give me a simple example?
|
 |
 |
datadoit
|
| Posted: 06/02/2011, 5:33 AM |
|
http://docs.codecharge.com/studio40/html/ProgrammingTec...BValue.html?toc
|
|
|
 |
rho
Posts: 85
|
| Posted: 06/02/2011, 11:49 PM |
|
Thanks datadoit. My reply would be along the same lines.
|
 |
 |
dzul
Posts: 5
|
| Posted: 06/03/2011, 1:56 AM |
|
thanks guys
but one more question..hehehe..how can i set a value to label from database?
like this:
i got a name of user which is a ID (integer) and i want to show the name at label int he next page. now it show as a interger.
|
 |
 |
rho
Posts: 85
|
| Posted: 06/03/2011, 3:56 AM |
|
The way you formulate your question makes it difficult for me to understand what exactly your problem is. I suggest that you read up on Labels in
http://docs.codecharge.com/studio40/html/index.html?htt.../Label.html?toc
and/or build one of the tutorials, see:
http://docs.codecharge.com/studio40/html/index.html?htt...QuickStart.html
This will give you a quick&easy way to start with and understand to possibilities with Codecharge and application development in general.
With regards to your label: make sure it's DataType is 'Text' and set it's value in it's BeforeShow() event, for example:
$sender->Value = CCDLookup('person_name', 'table_persons', 'person_id='.$person_id, $db);
Good luck, Rob.
|
 |
 |
datadoit
|
| Posted: 06/03/2011, 5:59 AM |
|
http://docs.codecharge.com/studio40/html/Actions/Server/DLookup.html?toc
No programming required.
|
|
|
 |
dzul
Posts: 5
|
| Posted: 06/06/2011, 5:24 PM |
|
thanks rob and datadoit ;) now solve..hehehe..and understand what rob mean;)
but i got error when publish the project :
The value in field Tarikh Aduan is not valid. Use the following format: dd/mm/yyyy.
what this error mean? i change the property and same error i got
|
 |
 |