Fix a simple coding error on my site!

Ολοκληρωμένο Αναρτήθηκε Πριν 3 χρόνια Πληρώθηκε κατά την παράδοση
Ολοκληρωμένο Πληρώθηκε κατά την παράδοση

I have a site that uses Google Maps to show restaurants based on the customers postcodes. This was working fine, up until I updated the site. Now it gives me the error:

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FIND_IN_SET('CC11 1', REPLACE(REPLACE(postal_codes, ', ', ','), ' ,', ',')) >...' at line 34.

Here is the code im using.

$geocode_stats = file_get_contents("[login to view URL]".urlencode($address)."&key=AIzaSyBq_MpoR7_VALY64VHStOyOrvfpmvpAB_o");

$output_deals = json_decode($geocode_stats);

if(isset($output_deals->results[0])){

foreach($output_deals->results[0]->address_components as $cp){

if($cp->types[0] == 'postal_code'){

$pcode = $cp->long_name;

if(strlen($pcode) > 6){

$pcode = substr($pcode, 0, 6);

}

$and .= "FIND_IN_SET('".$pcode."', REPLACE(REPLACE(postal_codes, ', ', ','), ' ,', ',')) > 0 ";

}

}

}

if(empty($and)){

$and .= 'distance < ' . $home_search_radius . ' ';

}

PHP MySQL JavaScript Google Maps API JSON

Ταυτότητα Εργασίας: #26453059

Σχετικά με την εργασία

7 προτάσεις Απομακρυσμένη εργασία Ενεργό Πριν 3 χρόνια

Ανατέθηκε στον:

omsolutions4

hello I can fix this quickly; I have over 10 years in web development experience; and i can take care of the issue with the database giving the information

£10 GBP σε 7 μέρες
(8 Αξιολογήσεις)
4.6

7 freelancers κάνουν προσφορές κατά μέσο όρο £23 για αυτή τη δουλειά

tindo9000

Let's debug that issue just now if you're available, you system should be back online in less than 1 hour.

£24 GBP σε 1 μέρα
(8 Αξιολογήσεις)
3.6
Solution24Seven

Hello We have read your website issue please shares website details, we will fix your bug soon; please reply soon for start work now. We have professional team of website developers. Kindly message me to tell me deta Περισσότερα

£35 GBP σε 2 μέρες
(2 Αξιολογήσεις)
3.1
hassansystem

Expert in Web Designing and Development, I can Built or revamp your Website with all of Requirements. Ready to start Work with you! Inbox me and let's talk to get started!

£15 GBP σε 7 μέρες
(2 Αξιολογήσεις)
2.8