$sql = q("INSERT INTO book SET id_book = '', date_add = '".es(date('Ymd H:i:s'))."', title_book = '".es($_POST['title_book'])."', annot_book = '".es($_POST['annot_book'])."', descr_book = '".es($_POST['descr_book'])."'"); $id_book= DB::_()->insert_id; $a_f_author = array(); foreach($_POST['FIO_author'] as $key=>$value){ $f = array(0=>'NULL',1=>'"'.$value.'"',2=>'"'.$_POST['alias'][$key].'"'); $a_f_author[] = '(' . implode(',', $f) . ')';} $sql2 = "INSERT INTO author_book (id_author,FIO,alias) VALUES" .implode(',', $a_f_author); echo wtf($sql2); //Результат без запроса,просто вывод на экран: INSERT INTO author_book (id_author,FIO,alias) VALUES(NULL,"Ибрагимов","Ибра"),(NULL,"Файзуллин","Фейз") Book - Linking Table - Author.
- Added author to table Author
- Added a book to the table Book.
But I can not understand how to add the id of two authors to the Spreadsheet? ..