I implemented a full text search in my MySql Database using php and it works well but whenever I get a data from the database it comes with extra column of a string of numbers with the value of the column before it
"id": 15,
"0": 15,
"userId": "uid",
"1": "uid",
"name": "Bright",
"2": "Bright",
"mail": "[email protected]",
"3": "[email protected]",
"number": "070",
"4": "070",
"gender": "",
"5": "",
This is my search query
///....
public function query($query, $params = [])
{
try {
$this->statement = $this->connection->prepare($query);
$this->statement->execute($params);
return $this;
} catch (PDOException $e) {
abort($e->errorInfo[2], 500);
}
}
///....
if ($method === 'GET' && !$id) {
$user = $db->query("SELECT * FROM users WHERE MATCH (name) AGAINST (? IN BOOLEAN MODE) LIMIT 10", ['bright -Bauchi'])->all();
echo Response::res("Successfully retrieved users", $user);
}
And this is how i created my fulltext index
CREATE FULLTEXT INDEX user_index_index ON users (name);
How do i remove that unneccessary info from my data