Susie C
|
| Posted: 08/26/2004, 12:50 PM |
|
Hi there
I am trying to populate a label (In the head of my HTML) from the (article_name) field in my db. I inserted a label in my 'HTML View' using the Forms tab in the CCS Toolbox. In BeforeShow event of the label I have tried code snippets found in this forum but no results. There is no grid reference, so how do I phrase the lookup.
This seems the closest but I can't get it to fit my problem.
$Label1->SetValue(CCDLookUp("expression","table","field=".CCToSQL(CCGetFromGet("fromurl"),ccsType),$DBinternet));
Thanks for any help. - CCS 2.3.2.24/PHP/MySQL
|
|
|
 |
DonB
|
| Posted: 08/26/2004, 4:00 PM |
|
It won't work unless there is a connection object on THAT page. If you have
none, create one:
$DBinternet = new clsDBinternet;
As to the things in quotes that you show, these are presumably actual names
of things in YOUR database, not generic placeholders from an example.
--
DonB
http://www.gotodon.com/ccbth
<SusieC@forum.codecharge (Susie C)> wrote in message
news:5412e3efbba80e@news.codecharge.com...
> Hi there
>
> I am trying to populate a label (In the head of my HTML) from the
> (article_name) field in my db. I inserted a label in my 'HTML View' using
the
> Forms tab in the CCS Toolbox. In BeforeShow event of the label I have
tried
> code snippets found in this forum but no results. There is no grid
reference,
> so how do I phrase the lookup.
>
> This seems the closest but I can't get it to fit my problem.
>
>
$Label1->SetValue(CCDLookUp("expression","table","field=".CCToSQL(CCGetFromG
et("fromurl"),ccsType),$DBinternet));
>
> Thanks for any help. - CCS 2.3.2.24/PHP/MySQL
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Susie C
|
| Posted: 08/26/2004, 4:27 PM |
|
Thanks for your reply DonB
I am sorry I didn't post the code relevant to may situation.
My table is articles, Primary Key article_id, and field I am trying to populate label with is article_name. I have changed the code below to reflect this but I just get no result when I run it. I am still not sure how it works yet. I have no trouble with controls in the records and grids.
global $article_name;
$db = new clsDBleadmill;
$article_name->SetValue(CCDLookUp("article_name","articles","article_id=".CCToSQL(CCGetFromGet("article_id"),ccsText),$db));
Thanks
Susie
|
|
|
 |
Susie C
|
| Posted: 08/26/2004, 4:33 PM |
|
Oh! I got the code from this forum post ... http://forums.codecharge.com/posts.php?post_id=12465&s_keyword=
I want to get the name for each of my records.
|
|
|
 |
Susie
Posts: 1
|
| Posted: 08/28/2004, 4:36 AM |
|
Hi
I got this code to work in the BeforeShow event of my label but it is not dynamic. I find that I approached my problem with the wrong logic.
global $article_name;
$db = new clsDBleadmill;
$article_name = CCDLookUp("article_name", "articles", " article_id = ".$db->ToSQL($article_name->GetValue(), ccsText), $db);
$db->query($sql);
unset ($db);
I have 20 article products that I want to add to a javascript based shopping cart. I need to populate my label 'article_name' (in javascript within the head tags of my HTML).
I need the OnClick of a button to print the article_name in the javascript, before the parameter is passed on to the next page. I tried my code on the Server>OnClick event of my button but I am not getting anywhere and my forum searches have not brought up anything similar as far as I can see.
Has anyone had any experience doing this who is willing to share.
Any help in the right direction will be appreciated.
Thanks
Susie C
|
 |
 |
|