Skip to content

Tag: mysql

How to pass a php variable in WHERE clause of SELECT statement?

I have a php variable that I want to fetch another field in database using this variable in my where clause. My code: But this is printing me nothing. Don’t know where I am going wrong but any help would be appreciated. Answer You can either break the string and concatenate the variable with “..&#…

Mysql: GROUP BY custom date interval

Situation : a table where every minute X energy device saves its consumption. I have to calculate the daily consumption (at hourly intervals, 00 – 01 – 02 – 03 – 04 ….. 23) of a single device on a …