在数组php中插入地理数据类型的数据

时间:2016-01-27 01:06:55

标签: php mysql codeigniter sqlgeography

我在将地理数据插入sqlserver数据库时遇到问题。这是我的阵列:

这是我的控制器

已更新

  function add()
  {
    $Code = $this->input->post('Code');
    $Description = $this->input->post('Description');
    $Data= $this->input->post('Data');
    $Data2= $this->input->post('Data2');
    $Data3= $this->input->post('Data3');
    $Latitude = $this->input->post('Latitude');
    $Longitude = $this->input->post('Longitude');       
    $Highway_Type = $this->input->post('Highway_Type');

    $data = array(
    'Code' => $Code, 
    'Description' => $Description,
    'Data' => $Data,
    'Data2' => $Data2,
    'Data3' => $Data3,
    'Latitude' => $Latitude,
    'Longitude' => $Longitude,
    'Highway_Type' => $Highway_Type,
    'GeoLocation' => 'geography::Point('.$Latitude.', '.$Longitude.', 4326)',               
    );

    $parent_id = create_data('Table', $data, $user_id);
  }

地理定位是问题,因为它的地理数据类型。我无法插入因为我得到了这个:

this is screenshot of error

我如何摆脱地理类型的' '不应该有' '的东西?

这是创建数据的功能

function create_data($model_name, $data, $user_id)
{
    $ci =& get_instance();
    $ci->load->database();

    $ci->db->insert($model_name, $data);

    return $ci->db->insert_id();
}

0 个答案:

没有答案