I have to specify the time when the rows should be selected: 1) only more than that, 2) only now less , 3) In any single question based on single variable,
$ end = wrong (1) / true (2) / null (3); If ($ end === false) {// more then now $ date = $ now; } And if ($ ends === faucet) {// a date $ date = '71 71-01-01 00:00:00'; } And if ($ ends === true) {// less then now ??? } SELECT * from the table where the date & gt; : Date
How can I modify the query to select now less date? I tried to keep the variable sign (>) in the $ date, but the PDO returns the error
UPDATE
Single Query, Single Variable If I want to search for finished lines, set $ end = true only, search for non-finished rows only $ Finish = false etc. Set up. Here's my work example:
$ now = date ('y-m-d h: i: s'); If ($ end === empty) {// search for any rows $ = $ after now; $ First = $ now; } And if ($ end === true) {// search for finished rows (date & lt; = now) $ later = null; $ First = $ now; } And if ($ Finish === false) {// Search for rows ended (date & gt; now). $ = $ After now; $ First = null; } $ Query = $ this- & gt; Db- & gt; Prepare ("Select from * From the table (Date & gt ;: or Date after & lt; =: First)"); $ Query-> Execution (array (': after' = & gt; $, ':' before = = first;););
No comments:
Post a Comment