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 ?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.