这是我的代码,我不断收到“查询空错误”。我正在尝试让 sql 查询数据库以使用全文返回答案(新手)
<?php
include ('db_connect.inc.php');
$questions = $_GET['string'];
$terms = explode(" ", $questions);
$string = "SELECT DISTINCT Answer, MATCH(Questions.Questions) AGAINST('";
$string2 = "AS relevance FROM Questions, Answers WHERE Questions.Answer_id = Answers.Answer_ID AND MATCH(Questions.Questions) AGAINST('";
for($i = 0; $i < sizeof($terms); $i++)
{
if($i == sizeof($terms))
{
$string = $string + $terms[$i] + "')";
$string2 = $string2 + $terms[$i] + "') LIMIT 1";
}
else
{
$string = $string + $terms[$i] + ",";
$string2 = $string2 + $terms[$i] + ",";
}
}
$result = mysql_query($string . " " > $string2) or die(mysql_error());
echo $result;
$row = mysql_fetch_array($result);
echo $row[0];
?>