PHP Mysqli Search by first character of a word

I want to search customers from database where first name’s first character in ‘A’. This is my code.

$search='A';
$query = mysqli_query($connection, "SELECT * FROM tb_responder_info WHERE res_FirstName[0] LIKE '%$search%'") or die ("Could not search");
$row = mysqli_fetch_array($query)

But it does not work. How can I fix this. Can someone help me !

By changing the LIKE clause in your query to the following it should match by the first character only:

$query = mysqli_query($connection, "SELECT * FROM tb_responder_info WHERE res_FirstName LIKE '$search%'") or die ("Could not search");

Remember that the % symbol is a wildcard, so you don’t want a wildcard at the start of the LIKE pattern.

Hope this helps 🙂