PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > SELECT not working???
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
SELECT not working???

Réponse
 
LinkBack Outils de la discussion
Vieux 02/10/2007, 21h10   #1
JimJx
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut SELECT not working???

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

  Réponse avec citation
Vieux 02/10/2007, 22h06   #2
Paul Lautman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: SELECT not working???

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.


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h09.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,06987 seconds with 10 queries