Jump to content

Search function.help needed


skeener

Recommended Posts

 

i'm creating a website where i can search between 2 spesific dates which user will enter in the format of DD-MM-YYYY. the 2 dates will be inserted into 2 fields which is $input1 and $input2.

 

heres my code:

 

extract($_POST);

 

//to set the date format

//***************************

$input1 = date('DD-MM-YYYY h:i:s');

$input2 = date('DD-MM-YYYY h:i:s');

 

$sql= "select TITLE,MAGIC,TIMEREG from title_table

WHERE MAGIC in ('X', 'Y', 'Z')

AND TIMEREG >= to_date('$input1','DD-MM-YYYY HH24:MI:SS')

AND TIMEREG<= to_date('$input2','DD-MM-YYYY HH24:MI:SS')

;

 

***but i get the error message saying

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Oracle][ODBC]Option value changed., SQL state 01S02 in SQLExecDirect in C:\php\www\aaa\s_bbb.php on line 86

Error in SQL statement

 

please help..thx in advance

 

 

Link to comment
https://forums.phpfreaks.com/topic/38249-search-functionhelp-needed/
Share on other sites

well if your doing it between to dates then use the BETWEEN where clause.

 

$sql= "select TITLE,MAGIC,TIMEREG from title_table
WHERE MAGIC in ('X', 'Y', 'Z')
AND TIMEREG BETWEEN to_date('$input1','DD-MM-YYYY HH24:MI:SS') AND to_date('$input2','DD-MM-YYYY HH24:MI:SS');

 

hope that can clear a little bit up for you. good luck.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.