I am trying to perform a simple text search.
However, if I use mysqli_real_escape_string
it makes the program buggy.
I have a Fulltext column title
, but the functionality does not work in phpMyadmin after I do :
PhpMyadmin
- **id|title**
- 1|cool boy
- 2|cool bottle
- 3|cool guy
- 4|hot man
Here is the rest of my php files :
file1.php
//from a form
$str = $_POST['q'];
$str=mysqli_real_escape_string($con,$str);
mysqli_query($con,"insert into tbl(title)values($str)");
file2.php
$str = $_GET['q'];
$data = mysqli_query($con,"select * from tbl where match(title)against('$str')");
while($row = mysqli_fetch_assoc($data)){
//do stuff . but yields nothing
}
How can I properly perform a Fulltext search of my title
column?