Hello to all. I have a problem I can not solve.
I have a table where there is a date field (datatime) where it goes automatically inserted the date and time of insertion. So 2013-09-02 12:00:00 AM. For me, this field is essential. Now I wanted to make a search form interval between two dates (for now because after I also need the time).
I tried this query PHP code:
$ query = "SELECT * FROM clients WHERE 1 = 1";
w_data $ = "";
if ($ data! = "") {$ w_data = 'between'% ". $ data."% 'AND'% ". $ data."% '";}
w_intervento $ = "";
if ($ action! = "") {$ w_intervento = "AND action LIKE '%". $ intervention. "%'";}
w_cognome $ = "";
if ($ name! = "") {$ w_cognome = "AND name LIKE '%". $ name. "%'";}
w_nome $ = "";
if ($ name! = "") {$ w_nome = "AND name LIKE '%". $ name. "%'";}
$ query. = $ w_intervento. $ w_cognome. $ w_nome. $ w_data. "ORDER BY id";
I did not return any results, and if I go on phpmysql inserting PHP code:
SELECT *
FROM `clients`
WHERE date
BETWEEN '2013-07-05% '
AND '2013-07-12% '
LIMIT 0, 30
working properly. How can I do?
In the search form so I put PHP code:
<input id="data" name="data" type="date">
<input id="data" name="data" type="date">
has been included twice because I need "from" "to" practically.
thanks