1
我试图寻找使用此代码的多个列:搜索多列MySQL和PHP
<?php
// Connection Database
$search = $_POST ['Search'];
mysql_connect("xxxxxx", "xxxxxx", "xxxxx") or die ("Error Connecting to Database");
mysql_select_db("xxxxx") or die('Error');
$data = mysql_query("SELECT CourseName, CourseDescription, CourseLeader FROM course MATCH (CourseName, CourseDescription, CourseLeader) AGAINST ('". $search ."')
or die('Error');
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array($data))
{
Print "<tr>";
Print "<th>Course Name:</th> <td>".$info['CourseName'] . "</td> ";
Print "<th>Course Description:</th><td>".$info['CourseDescription'] . "</td> ";
Print "<th>Course Leader:</th><td>".$info['CourseLeader'] . " </td></tr>";
}
Print "</table>";
?>
,我发现了以下错误:解析错误:语法错误,意想不到的T_STRING在/ home/a7105766/public_html/website/scripts/coursesearchdb.php on line 30
我在做什么错?
欢呼
即时获得'错误'... – addi 2010-05-24 22:11:45
@addi:看到我的更新:不要使用die('错误')' - 这对调试非常无益。将其更改为'die(mysql_error())'。这应该会为您提供查询的错误消息,希望您可以自己查找错误。 – 2010-05-24 22:16:07
即时获取此: 您的SQL语法中有错误;检查与您的MySQL服务器版本相对应的手册,以便在第1行的MATCH(CourseName,CourseDescription,CourseLeader)AGAINST('')'附近使用正确的语法,但不知道这意味着什么!是匹配错了? – addi 2010-05-24 22:23:24