Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.