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:
( 43 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
(68 Reviews)

20 freelancers are bidding on average $134 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
(438 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
(444 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
(81 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
(201 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
(127 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
(56 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
(29 Reviews)

Hello How are you? I have read your project description and I understand the SCOPE OF WORK. I found that I can be a perfect match for this project as I am a full-time freelancer over here. Let's Come to the Requiremen More

$140 USD in 7 days
(15 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
(23 Reviews)

******************Responsibility + Endless Effort = YOUR Satisfaction!************************ Hi.I'm Mikhail from [login to view URL] you for your check my bid. I've read your complete requirements and I can fulfill your t More

$140 USD in 2 days
(7 Reviews)

Please give me the opportunity to work with you. Wordpress is a simple project for me. Hello sir! Nice to meet you. I am very interested in your project. I am a Wordpress expert. I have rich experience in website More

$100 USD in 3 days
(8 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
(16 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
(3 Reviews)

Dear sir, I can do it. I am an expert website developer and designer with having 8 year experience in this industry . I can complete your project perfectly. I am confident in delivering your project successfully in tim More

$30 USD in 5 days
(5 Reviews)

Hello I am very interested in your job. As a web development expert, especially wordpress expert who have enough experience, I can do your job enough as you want. I have used ACF(Advanced Custom Field) plugin. Being re More

$50 USD in 1 day
(2 Reviews)

Hello, Sir Thanks for your posting. I've investigated your requirements carefully and i interested in your project. I have an experience wealthy in web development. If you want, I can show the product I've ever made. More

$140 USD in 7 days
(1 Review)

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
(2 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
(2 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)