最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

mysql - wpdb insert into point column in db

programmeradmin1浏览0评论

I am struggling to insert a combination of lat and lng into a point column in my database. I am trying the following, but i always get an error "cannot get geometry object from data you send to the GEOMETRY field.

I have tried:

$latlng   = "geoPoint=GeomFromText('POINT(" . $latitude . " ". $longitude . ")'";

and also

$latlng   = "POINT(" . $latitude . " ". $longitude . ")";

any advices? The following is the wpdb insert.

//db insert
 $wpdb->insert(
    'D4j7Qi13E_wpgmza', //Tabellenname
    array(          //daten
        'map_id' => 1,
        'address' => $formatted_address,
        'description' => $descritbion,
        'link' => $link,
        'lat' => $latitude,
        'lng' => $longitude,
        'anim' => 0,
        'title' => $title,
        'infoopen' => 0,
        'category' => $category,
        'approved' => 1,
        'retina' => 0,
        'type' => 0,
        'latlng' => $latlng
        )
);  
$wpdb->show_errors();
$wpdb->print_error();
发布评论

评论列表(0)

  1. 暂无评论