Pyscho
02-27-2005, 01:51 PM
$name = $_POST['p_name'];
if (!empty($name)) {
$result = "select * from product where name LIKE '$name'";
}
What I need is when the user types something like c* in the edit box, it will return all records where the product Name begins with c..
At the moment, I have it like if I enter c% in the edit box, then it will returns records where the name begins with c. BUT I don't want this, I need it to be so the user enters <letter*> (e.g. a*) and then it processes the query to return all recrds where name begins with <letter>
So, what im stuck on is how to get the input, e.g. c*, to something like
select * from product where name LIKE 'c%'
..thanks in advance.
if (!empty($name)) {
$result = "select * from product where name LIKE '$name'";
}
What I need is when the user types something like c* in the edit box, it will return all records where the product Name begins with c..
At the moment, I have it like if I enter c% in the edit box, then it will returns records where the name begins with c. BUT I don't want this, I need it to be so the user enters <letter*> (e.g. a*) and then it processes the query to return all recrds where name begins with <letter>
So, what im stuck on is how to get the input, e.g. c*, to something like
select * from product where name LIKE 'c%'
..thanks in advance.