|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi everyone,
I have a table with 4 columns in it, ID,Category,Name,Keywords I am trying to select the entries that have keywords that are submitted from a form. However, it does not always find the entry. For example if I select 'agriculture' from the form, I get a blank result when I know that there is an entry for 'agriculture'..... I am using this code $query = sprintf ( "SELECT Category,Name FROM valley WHERE Keywords LIKE '%$search%' ORDER BY name LIMIT %d,%d", $start - 1, $per_page + 1); } The strange thing is if I run this query through phpMyAdmin, I get no results either. There is an entry with agriculture in the keywords. farm, educational, voluntary, organization, governmental, agriculture Can anyone spot anything? Thanks! Jim |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
JimJx wrote:
> Hi everyone, > > I have a table with 4 columns in it, ID,Category,Name,Keywords > > I am trying to select the entries that have keywords that are > submitted from a form. However, it does not always find the entry. > For example if I select 'agriculture' from the form, I get a blank > result when I know that there is an entry for 'agriculture'..... > > I am using this code > > $query = sprintf ( > "SELECT Category,Name > FROM valley > WHERE Keywords LIKE '%$search%' > ORDER BY name LIMIT %d,%d", > $start - 1, > $per_page + 1); > } > > The strange thing is if I run this query through phpMyAdmin, I get no > results either. > > There is an entry with agriculture in the keywords. > > > farm, educational, voluntary, organization, governmental, agriculture > > Can anyone spot anything? > > Thanks! > Jim First thing I spot is that the table violates 1NF! The keywords should be in a separate table. Next I spot is that you have shown us some code, but not the query. Echo a successful query and an unsuccessful one and post them for us to take a look at. |
|
![]() |
| Outils de la discussion | |
|
|