Jump to content


Photo

What's wrong?


  • Please log in to reply
2 replies to this topic

#1 xam

xam
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 06 June 2006 - 10:14 PM

Hello everyone,

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

the sql code return with 0 results, it wont work.. Please help..

#2 xam

xam
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 06 June 2006 - 10:38 PM

I've changed sql table from latin to utf8 and now the code works but its case sensItIve now.. how do I ignore it?

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 07 June 2006 - 08:36 PM

[!--quoteo(post=380816:date=Jun 6 2006, 06:38 PM:name=xam)--][div class=\'quotetop\']QUOTE(xam @ Jun 6 2006, 06:38 PM) View Post[/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".
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users