Pulling my hair out, trying to figure out what’s wrong here.
Create table query:
CREATE TABLE search_data (
id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
address VARCHAR( 250 ) NOT NULL ,
title VARCHAR( 250 ) NOT NULL ,
time_stamp TIMESTAMP NOT NULL,
FULLTEXT (title)
) ENGINE = MYISAM
The query to search code:
$query = " SELECT * FROM search_data WHERE MATCH (title) AGAINST ('feedback')" ;
$result = mysql_query($query, $connection);
confirm_query($result) ;
while ( $row = mysql_fetch_array($result) )
{
echo "FOUND DATA- " . $row['address'] ;
}
The contents of the table: https://i.stack.imgur.com/ABMgC.jpg
This doesn’t work for some reason(no output). I just can’t figure out why. please help.
Edit:
confirm_query:
function confirm_query($result_set)
{
if (!$result_set)
{
die("Database query failed: " . mysql_error());
}
}
Edit2: on running the sql query manually: I get “MySQL returned an empty result set (i.e. zero rows).”
I checked for case sensitivity, but got the same thing
I got hung up the other day on Mysql’s minimum length for searching (defaults to 4 characters.. anything under 4 returns no results). See my post here for more info:
Why doesnt this complex MySQL query work?
Update:
I found that adding the search modifier, “IN BOOLEAN MODE” allowed the query to return results with my test: