ixie01
|
| Posted: 12/31/2002, 6:42 PM |
|
I want to use a custom select statement on a grid form as follows:
Select * From MyTable
Where CountryCode = {cntry}
-----------------------------
cntry is a text input parameter passed via the url string.
When CC builds the SQL statement I end up with:
Select * From MyTable
Where CountryCode = USA
How do I get the Where statement to read;
Where CountryCode = "USA"
so it will work?
I'm using PHP, am new and baffled.
Any help would be appreciated.
|
|
|
 |
RonB
|
| Posted: 01/01/2003, 1:01 AM |
|
I take the CountryCode is a parameter passed to the grid via the url?
If so you can use the query builder add the parameter and set source to url
That's all.
RonB
|
|
|
 |
ixie01
|
| Posted: 01/01/2003, 6:14 AM |
|
Let me further clarify. I am using Code Charge 2.0 and don't think I have a query builder. I want to use a custom sql select string which will select records based on parameters passed in the url. I am setting the form parameters on the "input tab" of the form properties to match on the incoming url parameters, however I need a complex "order by" with multiple values in my sql select statement so I need to add a custom sql statements via the "sql tab" in the form properties.
The help screens indicate that I do this with a statement like the following:
Select * From MyTable
Where CountryCode = {cntry}
Acoording to the help the {cntry} will be replaced with the actual value of cntry which happens to be a url parameter. When the sql statement is built by CC 2.0 it does exactly that. The select statement is built as follows:
Select * From MyTable
Where CountryCode = USA
This is an error to MySQL since there are no quotes around the replaced value USA. It should be built something like this:
I want to use a custom select statement on a grid form as follows:
Select * From MyTable
Where CountryCode = {cntry}
-----------------------------
cntry is a text input parameter passed via the url string.
When CC builds the SQL statement I end up with:
Select * From MyTable
Where CountryCode = "USA"
This is just a simple example to illustrate my problem - the actual sql statement is far more complex.
But you see my problem is that CC2.0 does not put the quotes around the replaced value {cntry} which is defined in the form properties on the input tab as a text parameter.
What do I need to do to get CC2.0 to build the sql string correctly?
Thanks
|
|
|
 |
ixie01
|
| Posted: 01/01/2003, 6:32 AM |
|
Sorry about the cut and paste mess I made in the previous reply. Simply put, I want to use a custom sql string in CC2.0 like this:
Select * From MyTable
Where CountryCode = {cntry}
and have CC2.0 build the string to pass to MySQL that looks like this:
Select * From MyTable
Where CountryCode = "USA"
not this:
Select * From MyTable
Where CountryCode = USA
|
|
|
 |