Help writing Wordpress/ACF related PHP/SQL statement

I have a website that is integrated with Wordpress and the ACF plugin. I need some help writing an SQL statement to query the data I need. This is the statement so far

"SELECT ID, ( 3959 * acos(cos( radians( ".$_GET[lat]." ) ) * cos( radians( pm1.meta_value))

* cos( radians( pm2.meta_value ) - radians( ".$_GET[lng]." ) )

+ sin( radians( ".$_GET[lat]." ))

* sin( radians( pm1.meta_value) ) ) ) AS distance

FROM wp_posts

LEFT JOIN wp_postmeta AS pm1

ON pm1.post_id = [login to view URL]

AND pm1.meta_key = 'latitude'

LEFT JOIN wp_postmeta AS pm2

ON pm2.post_id = [login to view URL]

AND pm2.meta_key = 'longitude'

HAVING distance <= ".$_GET[radius]."

ORDER BY distance ASC;"

This statement queries Wordpress posts and returns them in order of their distance using LAT/LONG co-ordinates.

I need to add some extra filters to this query. I need to also filter by:

- (ACF Field) event_start_date => today

- WP post status = published

That's it! Thank you.

Skills: PHP, WordPress, MySQL, HTML, SQL

See more: acf number field, acf query, acf image, acf post object query, acf repeater image, advanced custom fields relationship query, wordpress advanced custom fields documentation, acf relationship, flash php sql highscore, help writing sql statements software, writing sql statement sample code visual basicnet 2005, writing delete selected sql statement, print sql statement php code igniter, convert sql statement result pdf php, writing sql statement increase salary, need help writing sql statements, help writing sql, salon iris sql statement help, help writing sql scripts, wordpress related php

About the Employer:
( 48 reviews ) York, United Kingdom

Project ID: #21360682

Awarded to:


I can provide help implementing the filters you need on your SQL query and also help implement PHP code to add filters accordingly based on user input if required. I have been a website developer for more than 6 years More

$30 USD in 1 day
(77 Reviews)

14 freelancers are bidding on average $148 for this job


Ready to work with you, could you please send me some more details about your project so we will estimate it accordingly....

$225 USD in 5 days
(483 Reviews)

Hello zynsk!, Please check few sample sites out of 1000's or others. [login to view URL] [login to view URL] [login to view URL] [login to view URL] Ready to complete your all requirements professionally. We have developed t More

$250 USD in 5 days
(463 Reviews)

I can help you out with adding extra filters etc to advanced custom field plugin and can start now . Let's talk over in chat and discuss there

$200 USD in 2 days
(268 Reviews)

Hi. sir. Glad to meet you I checked your project description carefully. I mastered mobile and web development and have much experience, so I am very confident to do this project. :) I'm not an agent or broker but a sen More

$140 USD in 7 days
(85 Reviews)

Hello Hope you’re doing well.!!!!! I have gone through the job requirements carefully. I will deliver you brilliant results on the requested Job. We are experts in the following technologies: - Web---- Wordpress, php More

$200 USD in 10 days
(132 Reviews)

Mark S. could you please inbox me more detail about this project ==== Ready for an Immediate start ==== Based on your mentioned set of requirements…. I I am an expert web designer/developer and have extensive experien More

$120 USD in 2 days
(56 Reviews)

I AM AMONG TOP 9% OF BEST FREELANCERS. I always have Proof of Concept * When you send a message me directly then I send you the profile to introduce my testimonial videos that my clients review by video as well as my More

$140 USD in 7 days
(64 Reviews)

HI,client. I 'm expert in Wordpress as well as the query expert. I can solve your problem quickly. please let's meet and then discuss more. thanks.

$140 USD in 2 days
(58 Reviews)

Hi, Greetings!!! We are glad to submit a proposal for your project. We’ve been engaged in SEO, Web Development & Web Designing in Word Press since 5+ Years. We have gone through requirements & would like to work on y More

$130 USD in 5 days
(54 Reviews)

Hello, ⭐⭐⭐How are you?⭐⭐⭐ I read through the job details extremely carefully and I am absolutely sure that I can do the project very well. I would love to work on your project and I'm confident that I can give the res More

$140 USD in 7 days
(6 Reviews)

Dear Client. ****************** High-quality & Fast-delivery is promised! As a highly skilled full stack developer and PHP expert. I can help you perfectly. I am very confident with my skills and I'd like to help your More

$140 USD in 7 days
(3 Reviews)

We have read your description and understood the job. we are interested and we can develop website for you. we have an experienced full stack developers with over 4 years of [login to view URL] have master command in WordP More

$80 USD in 2 days
(5 Reviews)

Hello. I read your details carefully. I am a wordpress master and I have rich experiences of developing wordpress. If you hire me, i will provide the best service. I can do it very fast. And also i will continue to wor More

$140 USD in 7 days
(0 Reviews)