php - Codeigniter's update_batch for POINT type MySQL data type?

35
$locations[] = [
                 'id' => $r['id'],
                 'city' => $loc['city'],
                 'state' => $loc['state'],
                 'country' => $loc['country'],
                 'long_lat' => "POINT(".$loc['longitude']." ".$loc['latitude'].")"
               ];

$this->db->update_batch('locations', $locations, 'id');

My table has a POINT datatype column for long_lat. The above snippet does not work with the long_lat insertion entry, without it it works fine. For some reason, update_batch cannot handle the POINT() datatype.

Codeigniter doesn't seem to like the POINT type, or its escaping something. Is there a work around for this?

389

Answer

Solution:

i can't comment so.. try it like this and it will help if you echo the query and post it

'long_lat' => "'POINT(".$loc['longitude']." ".$loc['latitude'].")'"

People are also looking for solutions to the problem: php - App Engine PHP72 Standard Environment, accessing env_variables in local environment

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.