Title: Get Long from database
Last modified: August 21, 2016

---

# Get Long from database

 *  Resolved [tkhan](https://wordpress.org/support/users/tkhan/)
 * (@tkhan)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/get-long-from-database/)
 * Hi Eyal,
 * I want to let buddypress members post from the frontend and automatically assign
   the geo details they provided in their buddypress profiles to their posts.
 * I have managed to grab most of the members details from the wppl_friends_locator
   table except for the long value which I just cant get to work.
 * The following gets the lat value
 * $mylat = $wpdb->get_var(“SELECT lat FROM wppl_friends_locator WHERE member_id
   = ‘$user_id'”);
 * but for some reason this does not work for the long value
 * $mylat = $wpdb->get_var(“SELECT long FROM wppl_friends_locator WHERE member_id
   = ‘$user_id'”);
 * any idea why this might be happening.
 * Also is there anyway I can get the _wppl_lat, _wppl_long and _wppl_address meta
   to update via the frontend form. I have tried updating meta values (note: the
   values are there if I check the source but the default new york values remain
   in the fields on the actual page and override my hidden values if I update from
   the backend dropping the database entry.
 * Any feedback would be greatly appreciated.
 * Thanks Tkhan
 * [http://wordpress.org/plugins/geo-my-wp/](http://wordpress.org/plugins/geo-my-wp/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Eyal Fitoussi](https://wordpress.org/support/users/ninjew/)
 * (@ninjew)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/get-long-from-database/#post-4133710)
 * Hi Tkhan,
    1) to get the long value try using : $mylat = $wpdb->get_var(“SELECT`
   long` FROM `wppl_friends_locator` WHERE member_id = ‘$user_id'”); The issue happening
   because long is MYSQL reserved word and that i didn’t know when i initially created
   the plugin. Just wrap it with grave accent like above and it should work. 2) 
   I am not sure i understand exactly what is happening when you are trying to update
   the meta values from the front end. But if you are trying to update post’s location
   you need to update the meta values _wppl_lat, _wppl_long, _wppl_address as well
   as the data in the wp_places_locator table.
 *  Thread Starter [tkhan](https://wordpress.org/support/users/tkhan/)
 * (@tkhan)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/get-long-from-database/#post-4133834)
 * Hi Eyal,
    The grave accents did the trick! The meta fields are also now working,
   I must have had a typo somewhere.
 * Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Get Long from database’ is closed to new replies.

 * ![](https://ps.w.org/geo-my-wp/assets/icon-256x256.gif?rev=2803407)
 * [GEO my WP](https://wordpress.org/plugins/geo-my-wp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/geo-my-wp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/geo-my-wp/)
 * [Active Topics](https://wordpress.org/support/plugin/geo-my-wp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/geo-my-wp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/geo-my-wp/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [tkhan](https://wordpress.org/support/users/tkhan/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/get-long-from-database/#post-4133834)
 * Status: resolved