I am trying to come up with a query that will generate results based on letter patterns of a string contained in the database.
Basically this is what I am trying to do:
Test 1: "T" => mysql returns: toys, tofu, telephones, turkeys, televisions, topaz
Test 2: "To" => mysql returns: toys, tofu, topaz
Test 3: "Toy" => mysql returns: toys
Test 4: "Toys" => mysql returns: toys
This is what i tried so far ($searchword corresponds to test case string):
$results = mysql_query("SELECT * FROM products WHERE prod_name LIKE %".$searchword."%");