Serialize field in SQL condition and compare greater than

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Serialize field in SQL condition and compare greater than



I have two dates in serialized field in my DB . That filed looks like



a:2:{i:0;s:8:"20180801";i:1;s:8:"20180808";}


a:2:{i:0;s:8:"20180801";i:1;s:8:"20180808";}



My important variable looks like $data = $_GET['DATA'];


$data = $_GET['DATA'];



Now I want get all post where $data is between dates in serialize field.



For example:



If $data = 20180805 my query should find post with that field


$data = 20180805



a:2:{i:0;s:8:"20180801";i:1;s:8:"20180808";}


a:2:{i:0;s:8:"20180801";i:1;s:8:"20180808";}



My query looks like:


$test2 = $wpdb->get_results("
SELECT DISTINCT post_id
FROM wp_postmeta
WHERE meta_value >= '$data'
AND meta_value <= '$data'
", ARRAY_A);



If it help I use ACF repeater field



Thanks in advance :)









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Visual Studio Code: How to configure includePath for better IntelliSense results

Spring cloud config client Could not locate PropertySource

Makefile test if variable is not empty