RE: [PHP-DB] PHP query to mysql database returns emtpy data, but Query Browser shows records

From: Date: Fri, 07 Jan 2005 11:26:07 +0000
Subject: RE: [PHP-DB] PHP query to mysql database returns emtpy data, but Query Browser shows records
Groups: php.db 
Request: Send a blank email to php-db+get-38064@lists.php.net to get a copy of this message
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 07 January 2005 03:25, Jason Walker wrote: > Graeme - you were moving in the right direction. Since the > data in the field > is varchar(250), the only thing that changes is the fact that the last > number is 3 digits. Other page queries were also affected > with 4 x 2 digit > numbers in the category field (eg. '37 48 49 52'). > > By adding '%' between each number and using 'LIKE' as opposed > to '=', the > queries through PHP return the correct value. > > I think is very strange as 3x numbers work fine when using > spaces (' ') > between each criteria (as in '37 48 53'). > > The change would look something like: > > SELECT description from cpProducts where category like '39%47%48%172' That's not a good idea, as it would also match entries like: 391 247 48 172 39 147 148 172 395 347 1486 1172 etc. I think you really need to find out exactly what's in those failing records, and why it's not matching your query.

« previous php.db (#38064) next »