0

I have calendar in php and two veriable : date3 , data4
When i run a statement

<input type="button" name="button2" id="button2" value="Date" onClick="javascript:alert('from date : '+this.form.date3.value+' ,to date: :'+this.form.date4.value);">

I have in response two dates
I need to use this dates in query to oracle to filtr result from db.

<?php
stmt=OCIParse($conn,"SELECT * FROM tests WHERE (TEST_TIME BETWEEN $date3 AND '$date4");
$ret=OCIExecute($stmt);
$nrows=ocifetchstatement($stmt,$results);

how to write correctly above stmt , and how to call query via button ?

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by C#Jaap
0

Usually you get input from a form by $_REQUEST['date3'] for date3.

The use of dates in queries does depend on your database. For Oracle I saw an example (that I cannot try because I currently haven't got an oracle db available):

SELECT * 
FROM EMPLOYEE 
WHERE END_DATE BETWEEN TO_DATE('04/15/2006' , 'mm/dd/yyyy') AND TO_DATE('04/15/2006' , 'mm/dd/yyyy')

I hope this helps. Good luck.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.