gpt4 book ai didi

php - 如何在php中搜索查询?

转载 作者:行者123 更新时间:2023-11-29 07:33:00 26 4
gpt4 key购买 nike

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

下面是代码:

 $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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com