Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8421885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:16:31+00:00 2026-06-10T03:16:31+00:00

I have two parameters in my stored procedure i.e. @startdate and @enddate. The user

  • 0

I have two parameters in my stored procedure i.e. @startdate and @enddate. The user selects startdate from text box and enddate also from text box. Then click submit.

I want to make sure if user leaves blank both the boxes, it should display data for the whole current month i.e. 01/08/2012 to 31/08/2012 now.

If user just selects date in any one of the boxes, the other text box should have the same value.

So I have declared variable as below and tried the condition but it always display data for whole month irrespective of what date is selected. I think there is a problem with my if condition.

$startdate = isset($_REQUEST['startdate']) ? $_REQUEST['startdate'] : null;
$enddate   = isset($_REQUEST['enddate']) ? $_REQUEST['enddate'] : null;
if (empty($startdate)) {
    $startdate = $enddate;
}
if (empty($enddate)) {
    $enddate   = $startdate;
}
if (empty($startdate))
    ;
if (empty($enddate))
    ;
$startdate = '01/08/2012';
$enddate   = '31/08/2012';
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:16:33+00:00Added an answer on June 10, 2026 at 3:16 am

    The last two if statements have no influence of the program flow. You always set $startdate and $enddate to the specified dates.

    You need:

    if(empty($startdate)) $startdate = '01/08/2012';
    if(empty($enddate)) $enddate = '31/08/2012';
    

    If you want to get the first and last day of the actual month every time you could use something like this:

    if(empty($startdate)) $startdate = date('01/m/Y', strtotime("-1 month"));
    if(empty($enddate)) $enddate = date('d/m/Y', strtotime("-1 month"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stored procedure with two parameters @startdate and @enddate And I have
I have a stored procedure that takes no parameters, and it returns two fields.
I have a stored procedure which accepts two parameters of type UniqueIdentifier When I
I have an Oracle stored procedure which takes two parameters: a custom data type
I have a stored procedure that takes two parameters as varchar(50) . The stored
I have a main report that prompts the user to enter two parameters (@ORI
I have a SqlCommand which runs a stored procedure that contains two integer output
I'm calling a mysql stored procedure with two input parameters. This is the code
right now I have the following query in a stored procedure. select * from
Workflow: I have two stored procedures. One stored procedure calls the other. When I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.