Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用join将数据从文件插入mysql_Php_Mysql - Fatal编程技术网

Php 使用join将数据从文件插入mysql

Php 使用join将数据从文件插入mysql,php,mysql,Php,Mysql,我的一个表中缺少数据账号,我正试图从文件中添加该数据。缺少数据的表称为“Custom65275887”,我遇到的问题是无法将数据插入正确的列。我必须将“Custom65275887”表连接到另一个名为“vicidial_list”的表,因为此表有一个电话号码,我将使用它来比较现有数据和传入数据。这两个表共有“lead_id”列,但传入的数据文件没有此“lead_id”数据 insert into custom_65275587(account) val

我的一个表中缺少数据账号,我正试图从文件中添加该数据。缺少数据的表称为“Custom65275887”,我遇到的问题是无法将数据插入正确的列。我必须将“Custom65275887”表连接到另一个名为“vicidial_list”的表,因为此表有一个电话号码,我将使用它来比较现有数据和传入数据。这两个表共有“lead_id”列,但传入的数据文件没有此“lead_id”数据

    insert into custom_65275587(account) 

                value
                   ($fileop[1])
                join
                   vicidial_list
                on

                custom_65275587.lead_id = vicidial_list.lead_id

                where
                   vicidial_list.phone_number = $fileop[0]
$fileop[1]是帐号 $fileop[0]是电话号码


在php中使用变量或在phpMyAdmin中使用填充的数据运行此命令时,我得到一个语法错误

我认为语法应该如下所示

insert into custom (X, X) values (X, X) from custom a
join vicidial_list b on a.key = b.key
where b.key = $variable;
这就是成功的原因

     update custom_65275587

                join
                   vicidial_list
                on
                   vicidial_list.lead_id = custom_65275587.lead_id
                set
                   custom_65275587.account = $fileop[1]
                where
                   vicidial_list.phone_number = $fileop[0]