Ошибка: Не удалось выполнить INSERT INTO `dat` (`beginheader`,`clk`, `float`, `typ`, `starttime`, `frames`, `starttrigger`, `stoptrigger`, `pda_reftimestamp`, `module_name_0`, `module_name_1`, `module_name_2`, `module_name_3`, `module_name_4`, `module_name_5`, `module_name_6`, `module_name_7`, `version`, `pdakeyinfo`, `pdakeyinfo2`, `pdadongleid`, `endheader`, `beginchannel`, `name`, `unit`, `pda_comment1`, `digchannel`, `pda_tbase`, `pda_typ`, `minscale`, `maxscale`, `xoffset`, `channel_offset`, `endchannel`, `endascii`) VALUES ('
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', ). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1Ошибка: Не удалось выполнить INSERT INTO `dat` (`beginheader`,`clk`, `float`, `typ`, `starttime`, `frames`, `starttrigger`, `stoptrigger`, `pda_reftimestamp`, `module_name_0`, `module_name_1`, `module_name_2`, `module_name_3`, `module_name_4`, `module_name_5`, `module_name_6`, `module_name_7`, `version`, `pdakeyinfo`, `pdakeyinfo2`, `pdadongleid`, `endheader`, `beginchannel`, `name`, `unit`, `pda_comment1`, `digchannel`, `pda_tbase`, `pda_typ`, `minscale`, `maxscale`, `xoffset`, `channel_offset`, `endchannel`, `endascii`) VALUES ('0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', '0.01
', ). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1Ошибка: Не удалось выполнить INSERT INTO `dat` (`beginheader`,`clk`, `float`, `typ`, `starttime`, `frames`, `starttrigger`, `stoptrigger`, `pda_reftimestamp`, `module_name_0`, `module_name_1`, `module_name_2`, `module_name_3`, `module_name_4`, `module_name_5`, `module_name_6`, `module_name_7`, `version`, `pdakeyinfo`, `pdakeyinfo2`, `pdadongleid`, `endheader`, `beginchannel`, `name`, `unit`, `pda_comment1`, `digchannel`, `pda_tbase`, `pda_typ`, `minscale`, `maxscale`, `xoffset`, `channel_offset`, `endchannel`, `endascii`) VALUES ('real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', 'real
', ). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1Ошибка: Не удалось выполнить INSERT INTO `dat` (`beginheader`,`clk`, `float`, `typ`, `starttime`, `frames`, `starttrigger`, `stoptrigger`, `pda_reftimestamp`, `module_name_0`, `module_name_1`, `module_name_2`, `module_name_3`, `module_name_4`, `module_name_5`, `module_name_6`, `module_name_7`, `version`, `pdakeyinfo`, `pdakeyinfo2`, `pdadongleid`, `endheader`, `beginchannel`, `name`, `unit`, `pda_comment1`, `digchannel`, `pda_tbase`, `pda_typ`, `minscale`, `maxscale`, `xoffset`, `channel_offset`, `endchannel`, `endascii`) VALUES ('19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', '19.02.2017 08', ). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1Ошибка: Не удалось выполнить INSERT INTO `dat` (`beginheader`,`clk`, `float`, `typ`, `starttime`, `frames`, `starttrigger`, `stoptrigger`, `pda_reftimestamp`, `module_name_0`, `module_name_1`, `module_name_2`, `module_name_3`, `module_name_4`, `module_name_5`, `module_name_6`, `module_name_7`, `version`, `pdakeyinfo`, `pdakeyinfo2`, `pdadongleid`, `endheader`, `beginchannel`, `name`, `unit`, `pda_comment1`, `digchannel`, `pda_tbase`, `pda_typ`, `minscale`, `maxscale`, `xoffset`, `channel_offset`, `endchannel`, `endascii`) VALUES ('0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', '0003600000
', ).
Ошибка: Не удалось выполнить INSERT INTO dat (clk, ) VALUES ('
'). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('
')' at line 1Ошибка: Не удалось выполнить INSERT INTO dat (clk, ) VALUES ('0.01
'). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('0.01
')' at line 1Ошибка: Не удалось выполнить INSERT INTO dat (clk, ) VALUES ('real
'). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('real
')' at line 1Ошибка: Не удалось выполнить INSERT INTO dat (clk, ) VALUES ('19.02.2017 08'). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('19.02.2017 08')' at line 1Ошибка: Не удалось выполнить INSERT INTO dat (clk, ) VALUES ('0003600000
'). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('0003600000
')' at line 1Ошибка: Не удалось выполнить INSERT INTO dat (clk, ) VALUES ('0000000000
'). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('0000000000
')' at line 1Ошибка: Не удалось выполнить INSERT INTO dat (clk, ) VALUES ('0000000000
'). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('0000000000
')' at line 1Ошибка: Не удалось выполнить INSERT INTO dat (clk, ) VALUES ('00063623091316040000
'). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('00063623091316040000
')' at line 1Ошибка: Не удалось выполнить INSERT INTO dat (clk, ) VALUES ('Generic unicast UDP
'). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('Generic unicast UDP
')' at line 1Ошибка: Не удалось выполнить INSERT INTO dat (clk, ) VALUES ('Generic unicast UDP
').;
foreach ($file as $key => $value) {
$arr = explode(":", $value);
if (!in_array('endASCII', $arr)) {
$sql = "INSERT INTO dat (clk, typ, starttime, frames, starttrigger, stoptrigger, pda_reftimestamp, module_name_0, module_name_1, module_name_2, module_name_3, module_name_4, module_name_5, module_name_6, module_name_7, version, pdakeyinfo, pdakeyinfo2, pdadongleId, beginchannel, name, unit, pda_comment1, digchannel, pda_tbase, pda_typ, minscale, maxscale, xoffset, channel_offset, endchannel) VALUES ('$arr[1]')";
if (mysqli_query($link, $sql)) {
echo "Запись успешно сохранена.";
} else {
echo "Ошибка: Не удалось выполнить $sql. " . mysqli_error($link);
}
}
}
PDA20 beginheader: clk:0.01 typ:real starttime:19.02.2017 08:55:11.050000 frames:0003600000 starttrigger:0000000000 stoptrigger:0000000000 $PDA_RefTimestamp:00063623091316040000 Module_name_0:Generic unicast UDP Module_name_1:Generic unicast UDP Module_name_2:Generic unicast UDP Module_name_3:Generic unicast UDP Module_name_4:Bits01 Module_name_5:Bits02 Module_name_6:Bits03 Module_name_7:Bits04 version:ibaPDA 6.24.6 PDAKeyInfo:0168b02050020302060068a4280021018b0c246a842850a2008114154880800023040918106880804080040d101068a08040800205001028008040800201081028200040800207 PDAKeyInfo2:0140008114520001040000040904700081141002040914700081040140000004700001040040000104700001041040000104300041041041008104600001040041200104600001114000011450000104104004090470008104104204091470008104114000010470000104104000010470000104104102050c70204184104100010c602001041040000104702041 channel_offset:O32877DC88C8C3070 endchannel: beginchannel:31 name:UNC1 Spd Fbk unit:mpm $PDA_comment1:IBA[32] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-327.68 maxscale:327.67 xoffset:000000000000 channel_offset:O7D8C6B96B8B87F39 endchannel: beginchannel:1073741856 name:UNC1 Trq Fbk unit:% $PDA_comment1:IBA[33] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-3276.8 maxscale:3276.7 xoffset:000000000000 channel_offset:O649C4F021C1C66EF endchannel: beginchannel:1073741857 name:UNC1 Diameter unit:mm $PDA_comment1:IBA[34] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-3276.8 maxscale:3276.7 xoffset:000000000000 channel_offset:O78AC2886F3F37A9D endchannel: beginchannel:1073741858 name:UNC1 Strip Width unit:mm $PDA_comment1:IBA[35] $PDA_Tbase:0.01 $PDA_Typ:int16 minscale:-3276.8 maxscale:3276.7 xoffset:000000000000 channel_offset:O08570B8CEFEF0AB8 endchannel: beginchannel:495 name:Exit AutoStop digchannel: $PDA_Tbase:0.01 xoffset:000000000000 channel_offset:O6F1F76E64949B3D9 endchannel: endASCII: NZ ---> дальше идут кракозябры
$file = file("P1802FAT_2017-02-19_08.55.11.txt");
$v = explode(":", $value);
print_r($v);
<option value="0">Нет родителя</option>
по первому id собираете массив parent_id первого уровня, потом, идя по первому уровню собираете в массив parent_id второго уровня и так далее., можете показать если не трудно на примере. Потому что может быть большая вложенность!
class m190102_165446_category extends Migration
{
// /**
// * {@inheritdoc}
// */
// public function safeUp()
// {
//
// }
//
// /**
// * {@inheritdoc}
// */
// public function safeDown()
// {
// echo "m190102_165446_category cannot be reverted.\n";
//
// return false;
// }
// Use up()/down() to run migration code without a transaction.
public function up()
{
$this->createTable('{{%category}}', [
'id' => $this->primaryKey()->notNull(),
'parent_id' => $this->integer()->null(),
'status' => $this->integer()->null(),
'title' => $this->string(255)->null(),
'alias' => $this->string(100)->null(),
'sort' => $this->integer()->null(),
'meta_title' => $this->string(200)->null(),
'meta_keywords' => $this->string(200)->null(),
'meta_description' => $this->string(200)->null(),
]);
$this->db->createCommand('SET foreign_key_checks=0')->execute();
$this->addForeignKey('fk-parent_id', '{{%category}}', 'parent_id', '{{%category}}', 'id', 'CASCADE');
$this->db->createCommand('SET foreign_key_checks=1')->execute();
}
public function down()
{
echo "m190102_165446_category cannot be reverted.\n";
return false;
}
}
public function up()
{
$this->createTable('{{%category}}', [
'id' => $this->primaryKey()->notNull(),
'parent_id' => $this->integer()->null(),
'status' => $this->integer()->null(),
'title' => $this->string(255)->null(),
'alias' => $this->string(100)->null(),
'sort' => $this->integer()->null(),
'meta_title' => $this->string(200)->null(),
'meta_keywords' => $this->string(200)->null(),
'meta_description' => $this->string(200)->null(),
]);
$this->addForeignKey('fk-parent_id', '{{%category}}', 'parent_id', '{{%category}}', 'id', 'CASCADE');
}
а сохранять в бд надо $arr[1]