Jump to content

What's wrong?


xam

Recommended Posts

Hello everyone,

I dont know whats wrong with below sql code..
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--]$keywords [color=orange]=[/color] trim($_GET[[color=red]"keywords"[/color]]);
$ekeywords [color=orange]=[/color] sqlesc($keywords);
$res [color=orange]=[/color] mysql_query([color=red]"[span style=\'color:blue;font-weight:bold\']SELECT[/color] [color=blue]COUNT[/color](*) [color=green]FROM[/color] [color=orange]posts[/color] [color=green]WHERE[/color] MATCH (body) AGAINST ($ekeywords)"[/span]) [color=blue]or[/color] sqlerr(__FILE__, __LINE__);
$arr [color=orange]=[/color] mysql_fetch_row($res);
$hits [color=orange]=[/color] 0 [color=orange]+[/color] $arr[0];
if ($hits [color=orange]=[/color][color=orange]=[/color] 0)
print([color=red]"[span style=\'color:orange\']<[/color]p[color=orange]>[/color][color=orange]<[/color]b[color=orange]>[/color]Sorry, nothing found![color=orange]<[/color]/b[color=orange]>[/color][color=orange]<[/color]/p[color=orange]>[/color]"[/span]);
else
{
showing search results....
[!--sql2--][/div][!--sql3--]

the sql code return with 0 results, it wont work.. Please help..
Link to comment
https://forums.phpfreaks.com/topic/11369-whats-wrong/
Share on other sites

[!--quoteo(post=380816:date=Jun 6 2006, 06:38 PM:name=xam)--][div class=\'quotetop\']QUOTE(xam @ Jun 6 2006, 06:38 PM) [snapback]380816[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I've changed sql table from latin to utf8 and now the code works but its case sensItIve now.. how do I ignore it?
[/quote]
Not sure how this fixed the problem, but you'll need to find a case-insensitive collation for your table, or else collate each argument "back".
Link to comment
https://forums.phpfreaks.com/topic/11369-whats-wrong/#findComment-42938
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.