I am working on importing an Excel with the PHPExcel library with PHP in codeigniter.
It has characters like " "
, not allowing the insertion to my database with Postgres. This is my function within the model that inserts the records:
public function excel($table_name,$sql)
{
//si existe la tabla
if ($this->db->table_exists("$table_name"))
{
//si es un array y no está vacio
if(!empty($sql) && is_array($sql))
{
//si se lleva a cabo la inserción
if($this->db->insert_batch("$table_name",$sql))
{
return TRUE;
}else{
return FALSE;
}
}
}
}
The error that throws me is the following:
Error Number:
ERROR: syntax error at or near ""country_sir,ps_pool"" LINE 1: ...on, comentario, current_cs_pool, id_country_sir," "country_s... ^
INSERT INTO "ept" ("att_site_name, att_node_name, att_name, att_tech, att_cell_id, att_cell_id_name, node_b_m2000, name, latitud, longitud, state, id_state, country, id_country, region, market, distance_from_mex_usa_border_line_miles, range, time_zone, cell_average_heihgt, altitude_m, solution, coverage, infraestructure_type, owner, mcc, mnc, nir, propagation_model, cell_radius_m, status, frec, band_indicator, band, band_width, ul_fc_mhz, dl_fc_mhz, ul_uarfcn_earfcn, dl_uarfcn_earfcn, carrier, cellname, node_b_id, physical_sector, cell_id, local_cell_id, psc_pci, rnc, rnc_id, lac_tal, tac, rac, ura, sac, time_offset, max_transmit_power_of_cell, pcpich_rs_power, antenna_height, geographic_azimuth, magnetic_declination, magnetic_azimuth, mech_tilt, elect_tilt, antenna_count_per_sector, antenna_model, beam_width, root_sequence_idx, tx_rx, ept_date, project, batch, update_type, update_date, vendor, cluster, operador, tracker, asl_local, asl_ift, nir_ift, _911, _89, region_celular, region_pcs, municipio, id_location, location, comentario, current_cs_pool, id_country_sir," "country_sir,ps_pool") VALUES (NULL)
Filename: C:/xampp2/htdocs/rf/system/database/DB_driver.php
Line Number: 691