Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Using curdate in SELECT statement

Using curdate in SELECT statement

Using curdate in SELECT statement

Hello all!

First I would like to say thanks to everyone who has posted here because I have found quite a few answers that I needed here on this forum that I have not found anywhere else.


Now to my question.

I have recently installed PHP on a seperate server than our Pervasive SQL v 9.5 database and have written a few pages and queries to help our Customer Satisfaction Department gather delivery information that our Profit program makes difficult to access.

For testing purposes I have shortened the query to this and have successfully displayed the results in my web browser, see below.

SELECT DISTINCT sls_his_cust_id
FROM sls_his
where sls_his_prchdat_alt = 20080801

This works great but would require me to change the PHP scripting to include a form field for the person to manually enter the date they want to see the info for and have it in the yyyymmdd format.

I would much rather not have to rely on them to enter this and be able to use the curdate feature. What I am shooting for is something like curdate - 3 days so that it would pull the customer data for those deliveries done 3 days ago.

I was also thinking that instead of curdate I could use a max query on the sls_his_prchdat_alt column and subtract 3... would that work and if so how would the syntax look?

RE: Using curdate in SELECT statement

It looks like your date value is not a standard PSQL / Btrieve date data type.  If that's the case, then you can create the data in the PHP code and pass it to the query.  The PSQL CURDATE function will only return a value in the form yyyy-mm-dd.   

Certified Pervasive Developer
Certified Pervasive Technician

RE: Using curdate in SELECT statement

Thanks... you are right it was just better to pass the date along with PHP since it is not a valid PSQL date format.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close