错误是程序无法搜索关键字。

这是下面的代码:

 $query = "SELECT english.word, maranao.word, maranao.pronounciation, maranao.grammar, english.definition" .
                "FROM english, maranao".
                "WHERE english.keyword_num = maranao.keyword_num and english.word = '$search'";

                $result = mysql_query($query) or die(mysql_error());

                while($row=mysql_fetch_array($result))
                {
                    echo $row['word'];
                    echo $row['pronounciation'];
                    echo $row['grammar'];
                    echo $row['definition'];
                }

最佳答案

您的WHEREFROM子句中需要空间

" FROM english, maranao".

" WHERE english.keyword_num = maranao.keyword_num and english.word = '$search'";


而且不要使用mysql Why shouldn't I use mysql_* functions in PHP?

尝试学习Prepared statement

关于php - 如何在php中搜索查询?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31939645/

10-10 15:34