For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > January 2005 > Simple(?) script problem for search by first character of a data field









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Simple(?) script problem for search by first character of a data field
Shaun

2005-01-24, 3:59 pm

Hello ALT.PHP.SQL users :),

I am having a small problem in this line which is a text box input
search function:

1) $sql="SELECT * FROM pschamber WHERE Business_Name LIKE
'%".$_POST['name']."%'";

What it currently does is a google type search on the business names
looking for rough matches. What I want to do is have it so when the
SELECT input is say 'A' it only returns items from the field
'Business_Name' beginning with the selected input 'A'.

I believe what I have to change from my line 1) is this section:

1a) LIKE '%".$_POST['name']."%'";

Does anyone have any suggestions or weblinks to give me a rough ideas
on how to have it match the first character.

Thanks for your interest and help,

Shaun
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com