Matt Wade wrote:
try something like this:
$name="Johnson";
$sub1 = substr($name, 0,1);
$sub2 = substr($name, 0,2);
$query = "SELECT * FROM table WHERE name LIKE '" . $sub1 . "%' OR name LIKE '" . $sub2 . "%'";
Note that the search for $sub1, which is a string starting with "J", precludes the use of the second search for a string starting with "Jo". Anything starting with "Jo" will be matched already by the search for anything starting with "J". They'd be useful in separate queries however!
Cheers!