CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Selecting with between in where clause

Print topic Send  topic

Author Message
Richard Duke
Posted: 11/06/2002, 1:01 AM

Hi

I am am working on a php/mysql project in Codecharge Studio and need to build a select statement which selects the value of a db field where the value of the field is between say 0 or 7. How do i add a BETWEEN to the select statement in CCS?

Many thanks.
RonB
Posted: 11/06/2002, 10:22 PM

Use the querybuilder to make the initial connections between the tables you want to use. After finishing that, still in the querybuilder, change the type from table to sql. Now CCS will generate the sql and you can splice in your between bit in the actual sql. All from the querybuilder

Or:

Use the querybuilder to make the initial connections between the tables you want to use.now go the parameter section and ad a parameter but change type to expression(in the parameter section) now type the between bit.

Hope this helps


Richard Duke
Posted: 11/08/2002, 2:12 AM

Thanks for your tip Ron. I have tried this but cannot get the expression code to be executed when the script runs. Below is the SQL query
SELECT *
FROM avail
WHERE DepDate = '{s_DepDate}' AND PrFo > {PrFo} AND from_grp = '{s_FromA}' AND to_grp = '{s_ToA}' AND ( Nts BETWEEN 's_Nts'-7 AND 's_Nts' )
ORDER BY PrFo

It is the BETWEEN part of the query that is being ignored

Any further help would be most appreciated.

Regards

RonB
Posted: 11/08/2002, 4:06 AM

If the between bit also gets fed by parameters it should be like:

Nts BETWEEN '{s_Nts}'-7 AND '{s_Nts}'

Hope this helps
Richard Duke
Posted: 11/09/2002, 4:37 AM

Thanks Ron. I have tried that and the select query brings back no results from the DB when it clearly should do. Is there a special CCS function that I need to use within the expression to tell CCS studio that the variables from the form are integers?

Thanks and regards

RonB
Posted: 11/09/2002, 4:57 AM

Hmm,

Oke, let's check some stuff. The defined parameters are supposed to be fed thrue values passed by the url. Are the values you want to be used in the sql present when you click the link to that page?
It would look something like:

http://www.yoursite.com/yourpage.php?s_DepDate=somevalu...s_Nts=somevalue

Ron
Richard Duke
Posted: 11/11/2002, 1:00 AM

Yes Ron the values for the parameters all contain a value on the link to the page.


Richard

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.