it--solutions
Posts: 24
|
| Posted: 08/28/2009, 4:45 PM |
|
Yet another frustrating codecharge feature that does not work out of the box, if anyone could be kind enough to shed some light on this.
The MySQL statement below works fine manually executed:
SELECT value FROM common_settings WHERE setting='swap_year'
returns the value: 2009
i'm trying to include this result as the value in a hidden field within my form
here is the dlookup panel which i've added to the BeforeShow Event of the hidden field

the error is in the "CRITERIA" section (WHERE STATEMENT)
as the apache log file spits this out: PHP Parse error: syntax error, unexpected '=' in /file.php
I have read other forums wanting to use where THIS = the session id, product code from a form, I just want
WHERE THIS = 'TEXT'
ie.
WHERE setting='swap_year'
Simple, nothing too difficult i would have thought?
Thanks in advance
|
 |
 |
datadoit
|
| Posted: 08/28/2009, 5:45 PM |
|
Double click on that Dlookup. It'll take you to the code that CCS
created.
Your problem will be in the single quote. You may need to escape it
first. (\')
|
|
|
 |
datadoit
|
| Posted: 08/28/2009, 5:48 PM |
|
I must enlighten folks on the power and flexibility of CCS, and this is
one of those areas... If the Dlookup statement is written correctly,
then when the application is swapped from PHP to another language such
as ASP, ZERO code rewrite will be required in situations such as this.
There is so much that can be accomplished in CCS with little or no
custom coding - the trick is finding the where and when.
|
|
|
 |
it--solutions
Posts: 24
|
| Posted: 08/28/2009, 6:36 PM |
|
Thanks for your quick response.
below is the code:
//DLookup @102-5222C97D
global $DBclubman;
$Page = CCGetParentPage($sender);
$ccs_result = CCDLookUp(value, common_settings, setting=\'swap_year\', $Page->Connections["clubman"]);
$ccs_result = strval($ccs_result);
$Container->year->SetValue($ccs_result);
//End DLookup
Have re-published the files, still getting this error
PHP Parse error: syntax error, unexpected '=' on line 38 which is
$ccs_result = CCDLookUp(value, common_settings, setting=\'swap_year\',
?so strange
|
 |
 |
damian
Posts: 838
|
| Posted: 08/29/2009, 12:12 AM |
|
i believe that you might have your syntax wrong... here is an example...
i want to do the following query:
select my_email from my_table where my_id=id (from url)
expression: my_email
domain: my_table
criteria: "my_id=".CCGetParam("id","")
connection: myconnection (as defined in your connection properties)
convert result to: Text
type of target: Control
target: my_label
so i think you have incorrectly used the quotes in criteria....
hth
damian
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
damian
Posts: 838
|
| Posted: 08/29/2009, 12:16 AM |
|
also - where/what is swap_year? is it a value stored in a session, url, field etc?
you need to tell the dlookup where/how to get this value? eg i used CCGetParam to grab it from the url....
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
it--solutions
Posts: 24
|
| Posted: 08/29/2009, 1:45 AM |
|
I'm building an event management system, primarily for swap meets, not sure if they are called that oversees, maybe car boot sale?
anyway theres 1800 individual sites and site holders at an annual Automotive Swap Meet.
the code on the other forum
http://forums.codecharge.com/posts.php?post_id=107735
worked just fine
"setting='swap_year'"
..its wasn't an issue of code logic, just syntax (Dots, Dashes & Inverted Commas)
Thanks everyone for your help
|
 |
 |
damian
Posts: 838
|
| Posted: 08/29/2009, 3:10 AM |
|
please post your answer.... others may benefit from it.
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
|