Page 1 of 1

error while trying to use MySQL fulltext search ...

Posted: Sat Jan 15, 2005 11:33 pm
by HormonX
I am trying to use full text search and am getting an error while i try to run the code.

Code: Select all

$query = "SELECT oid, MATCH (ad,oid) AGAINST ('$searchfor') FROM adtable";
$result = mysql_query($query, $link);
	
$row = mysql_fetch_row($result);

echo $rowї0];
This is the error i am getting ...

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/domain/public_html/portal/htmle/adpage.php on line 27



i belive that it has something to do with the $query statement ... but i just can't figure out what.

can anyone help ?

Greg

Posted: Sun Jan 16, 2005 12:49 am
by feyd
echo out mysql_error()

Posted: Sun Jan 16, 2005 11:13 am
by HormonX
i echo-ed mysql_error() and got that issue fixed .. but now a new problem came about ... i don't see any results. ....

Code: Select all

$query = "SELECT * FROM table WHERE MATCH column AGAINST ('$searchfor')";
$result = mysql_query($query, $link);
	
			while($r = mysql_fetch_array($result))
		{

				$var = $rї'var'];
				
				echo "$var";
		}
this is what i do ... it worked a 1000 times before but now it doesn't . I tried using a for() loop to show only for example 20 results ... but nothing. Can anyone tell me what am i doing wrong ?

Thank you.

Posted: Sun Jan 16, 2005 11:26 am
by JAM
Add this at the top of the script:

Code: Select all

ini_set('error_reporting', E_ALL);
Works well for debugging as alot of people have the levels set down to low to see mistakes...
--

Is var a fieldname in the database? Change it to

Code: Select all

{
    // $var = $rї0];
    // echo $var;
    print_r($r);
}
...ad see if that leads you anywhere.

Use

Code: Select all

echo $query;
after setting it so you see that youre sure that is in order.

Posted: Sun Jan 16, 2005 11:27 am
by Cronikeys
Also maybe post more of the script? I am usually very good at debugging :D

Posted: Sun Jan 16, 2005 11:31 am
by JAM
Cronikeys wrote:Also maybe post more of the script? I am usually very good at debugging :D
Yah please, don't take me wrong. I'm just making sure. =)

Try the same query in phpmyadmin or it's likes and see if at least that works. I'm no longer amazed at simple things making big bugs...

Still no luck, do paste more code or show_source() it somewhere.

Posted: Sun Jan 16, 2005 1:11 pm
by HormonX
i think i just tried just about everything and still having problems with full text search. I have tried to run a query withing phpmyadmin to see if it will work .. and guess what ... a big nothing.

Query is being executed without a problem but no results are being displayed. Not sure why this is not working right. I will try to investigate this issue further .. but later on. I have to concentrate of other functions of the site.

For now i am using s very simple method of searching ... i guess you can call it that using LIKE string in MySQL statement, it works for now and it will not be a heavy trafic site ... for now i will just leave it at that and try to solve the issue with full text search later.

thanx for your help :)

greg

btw ... can anyone help me with finding a way to create dependable pull down menu ? I would like to use java script and php so i don't have to refresh the page after initial selection. My javascript is as good as my french :) therefore i need some major help :) anyone can point me in the right direction ?

Posted: Sun Jan 16, 2005 1:57 pm
by AGISB
Did you add the fulltext index to the fields you want to search?

Also remember that all words less than 4 letters will yield a big nothing unless you set the mysql setting to a lower number.

Posted: Sun Jan 16, 2005 4:00 pm
by HormonX
AGISB wrote:Did you add the fulltext index to the fields you want to search?

Also remember that all words less than 4 letters will yield a big nothing unless you set the mysql setting to a lower number.
Sure did ... am not sure what i was doing wrong ... for now i just used easy way out .. and it works just fine. I will try to get full text search going down the road.