Discussion: Mysql querie problems
Afficher un message
Vieux 30/03/2006, 18h47   #2
Bill Karwin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Mysql querie problems

avandenbroeck wrote:
> The following code does not select the appropiate fields, it select
> everything with in a zip code ( as an example)and so on. I have tried to
> modify but I am a rookie and everything I tried has failed. please

.. . .

> where (keyword like '$keyword%' and zip='$zip'
> or key2 like '$key2%' and zip='$zip'
> or key3 like '$key3%' and zip='$zip'
> or name like '$name%' and zip='$zip'


I would guess that one of the following variables are a blank string:
$keyword, $key2, $key3, $name

For instance, if $key2 is blank, then you'll have a term in your query:
key2 LIKE '%' AND zip='01234'

A LIKE predicate comparing with '%' is always true.

So print the resulting string $query after you've interpolated all your
variables into it, and look for occurrances of '%'.

Regards,
Bill K.
  Réponse avec citation
 
Page generated in 0,05828 seconds with 9 queries