consultation of datepicker dates

Asked

Viewed 79 times

0

good afternoon guys. How do I view the database data through the date selected in the datepicker? How should select be used in this case? since it is the user who will choose the date to display the data.

  • Missing information, come on: is the Datapicker you refer to Jquery? What kind of data do you want to display all tables, or just one? Do you work with Ajax? What kind of connection would you use to connect to the bank? What have you done before?

  • Whoa, come on then. Yes, it is the jquery, about the data I want to display all, I am not working with ajax, utilzo php Pdo as connection to the database. I have practically done everything, just this question of showing the data according to the selected date, I am using SELECT as follows:

  • ´<? php $pdo_statement = $pdo_conn->prepare("SELECT * FROM table WHERE data >= cast((now()) as date) and data < cast((now() + interval 1 day) as date) ORDER BY data ASC;"); $pdo_statement->execute(); $result = $pdo_statement->fetchAll(); ? >

  • Add code to question

  • in this select I can show the data registered only in the day, the doubt is: how to present the data registered if the user selects the day 09/03/2018 (for example) in datepicker

  • The problem is how to show the result in the Graphical Interface? Or how to recover it from the database? Or how to capture the value of the datapicker and stream to PHP?

  • 1

    the problem is in recovering the database data as per the selected date and so show it on screen to the user

  • Now it’s much clearer.

  • ?????????????????????????????????????/

Show 4 more comments

1 answer

0

I would make a SELECT so for fields with date column or datetime:

SELECT * FROM tabela WHERE DATE_FORMAT(coluna_data, '%d/%m/%Y') = $data

DATE_FORMAT to format in the same pattern that comes from Jquery and $data is what the user sent from a look here to see more date formats

Browser other questions tagged

You are not signed in. Login or sign up in order to post.