php - Where clause and Order By not returning as expected in WordPress -


I am positive I am missing something.

I have a MySQL database table setup: kdate, Kday, kmonth, and content

with kdate's expiration date (admin input) 01-01-2014 Formatted as Date (MDY)

I am trying to get the dates in comparison to today to show the execution of the script.

  global $ wpdb; $ Today = Date ('M-D-Y'); $ Result = $ wpdb- & gt; Get_results ("select SELECT * FROM wp_kaltable WHERE kdate & gt; = $ today ORDER BY kdate ASC LIMIT 6"); // resonant "& lt; east & gt;"; Print_r ($ result); Echo "& lt; / pre & gt;"; Foreign Language ($ line result result $ line) {resonant "and" level class = 'calcutta' gt; & Lt; Div class = 'kal' & gt; & Lt; Div class = 'kdate' & gt; & Lt; P class = 'kimonath' & gt; "$ Line-> kmOnoth." & Lt; / P & gt; & Lt; P class = 'kday' & gt; ". $ Line-> kday." & Lt; / Div & gt; & Lt; Div class = 'content' & gt; & Lt; P class = 'ktext' & gt; "$ line- & gt; content." & Lt; / P & gt; & Lt; / Div & gt; & Lt; Div squared'click '& gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; ";}   

When I execute this script, I get all the data, even with less time than today's date

All help is appreciated.

(* This code is for testing purposes only)

P>

< Div class = "post-text" itemprop = "text">

Try instead:

  "SELECT * wp_kaltable WHERE kdate & gt; Cadet ASC LIMIT 6 "  

A single quote is important around today.

If the date code is kdate You can simply use the curtte () from mysql so that you do not have to move around in php:

  "SELECT * FROM wp_kaltable WHERE kdate & gt; = CURDATE () ORDER BY KDATE ASC limit 6 "  

If there is no date format, which is not working properly by your order, then those SQL statements None of the above will work. You have to convert the date format for & gt; =

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -