我得到一個不會有任何錯誤或警告。我的表稱爲產品,該字段稱爲名稱。我想找到第一和第二列之間的關係。爲什麼這段代碼不輸出結果?
爲什麼我在這裏失蹤?
<?php
mysql_connect("localhost"," "," ");
mysql_select_db(" ");
mysql_query('set names utf8');
$query = mysql_query("SELECT t1.name AS first FROM products t1");
$row = mysql_fetch_assoc($query);
if (!$query) {
die('Invalid query: ' . mysql_error());
}
do {
$first = $row['first'];
$query2 = mysql_query("SELECT t1.name AS first,
t2.name AS second,
(MATCH (t2.name) AGAINST ('$first')) AS relevance
FROM products t1, products t2
WHERE t1.name = '$first'
ORDER BY relevance DESC");
if (!$query2) {
die('Invalid query: ' . mysql_error());
}
$most_similar = mysql_fetch_assoc($query2);
} while ($row = mysql_fetch_assoc($query));
?>
這傷害了我的眼睛 –
@Matt Boothman原因是? – EnexoOnoma
這樣比較好。歡呼聲 –