-1
Good afternoon guys! All right?
I am developing a plugin that pulls from a database the television programs, it should pull by the time and show in a table the programs that are playing live, according to the system time (current time) and only change when starting the other program.
currently my select is like this:
SELECT *, DATE_FORMAT(horario, '%H:%i') as horario FROM wp_grade,
(SELECT horario AS a FROM wp_grade WHERE horario <= '$gh_data' order by horario DESC LIMIT 1) AS b WHERE horario >=a ORDER BY horario
This select works only for the time, but does not take into account the date (day, month and year).
the table is like this:
create table wp_grade(
id int primary key,
programa varchar(50),
descricao text,
horario datetime);
what change it should make?
Test if the date in the grid is equal to the date of the system. In your case the date part of your datetime field
horario
. Use the functionDATE(horario) = CURRENT_DATE
.– anonimo