Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.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 通过相似性链接值 问题_Php_Mysql_Comparison - Fatal编程技术网

Php 通过相似性链接值 问题

Php 通过相似性链接值 问题,php,mysql,comparison,Php,Mysql,Comparison,我有以下两个(示例)表格: 我需要做的是将第二个表中的名称与第一个表中的名称进行匹配。在实际表格中,值当然不是全部标记为“this-is-a-value”之类的 问题是表1和表2中的值从来都不完全相同。但它们非常相似。我正在寻找一种方法,在PHP或MySQL中,将这两个值匹配在一起 编辑 正如@Patrice所要求的,我对我所说的“非常相似”的意思有了更好的解释。我有一个网站名称和标题的集合 一个表的值为“google.com”,另一个表的值为“google.com-Search Engine”

我有以下两个(示例)表格:

我需要做的是将第二个表中的名称与第一个表中的名称进行匹配。在实际表格中,值当然不是全部标记为“this-is-a-value”之类的

问题是表1和表2中的值从来都不完全相同。但它们非常相似。我正在寻找一种方法,在PHP或MySQL中,将这两个值匹配在一起

编辑 正如@Patrice所要求的,我对我所说的“非常相似”的意思有了更好的解释。我有一个网站名称和标题的集合


一个表的值为“google.com”,另一个表的值为“google.com-Search Engine”。我想将这些值匹配在一起。

您可能想解释什么是“非常相似”。这可能会大大改变答案。从您的表来看,您可以执行一个简单的SQL-LIKE,这将起作用。因此,现在不区分大小写的LIKE将完成这项工作。
+----+-----------------+
| table_one            |
+----+-----------------+
| id | name            |
+----+-----------------+
| 1  | thisisavalue    |
| 2  | this-is-a-value |
| 3  | thisis-avalue   |
| 4  | this-isavalue   |
| 5  | this-is-avalue  |
| 6  | thisisa-value   |
| 7  | thisis-a-value  |
+----+-----------------+

+----+------------------------------------+
| table_one                               |
+----+------------------------------------+
| id | name                               |
+----+------------------------------------+
| 1  | thisisavalue andsomething-else     |
| 2  | this-is-a-value and-somethingelse  |
| 3  | thisis-avalue and-something-else   |
| 4  | this-isavalue andsomething-else    |
| 5  | this-is-avalue and-something-else  |
| 6  | thisisa-value  andsomething-else   |
| 7  | thisis-a-value and-something-else  |
+----+------------------------------------+