Answer the question
In order to leave comments, you need to log in
How to remove id and insert auto increment?
Hello!
There is a table that I import into the database through a PHP script:
$columns = "`id`,`pid`,`sort`,`name`,`region`,`city`,`street`,`house`,`descr`,`contact_person`,`tel`,`email`,`manager`,`foto`,`coords`,`randhash`,`activity`";
if ( ($handle_o = fopen($_SERVER["DOCUMENT_ROOT"]."/local/help/partners_20200331.csv", "r") ) !== FALSE ) {
while ( ($data_o = fgetcsv($handle_o, 1000, ";")) !== FALSE) {
$insertValues = array();
foreach( $data_o as $v ) {
$insertValues[]="'".addslashes(trim($v))."'";
}
$values = implode(',',$insertValues);
$values = iconv('CP1251', 'UTF-8', $values);
// $sql = "INSERT INTO `partners_adresses` ($columns) VALUES ($values)";
// $res = $DB->Query($sql, false, $err_mess.__LINE__);
}
}
fclose($handle_o);
Answer the question
In order to leave comments, you need to log in
So remove the id's from the request to get from the csv file.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question