RE: [PHP-DB] numeric string problem

From: Date: Wed, 13 Feb 2002 09:34:44 +0000
Subject: RE: [PHP-DB] numeric string problem
Groups: php.db 
Request: Send a blank email to php-db+get-16891@lists.php.net to get a copy of this message
yeah, i would go with Rick on this. however, the reason i think it's not working is because it's comparing the contents alphabetically ie. "2" is greater than "1" but is also greater than "10", "199999" etc etc alphabetically, just as anything beginning with "b" is greater than "a" and also "aazzxsd". if you absolutely must continue to use the varchar system, then do a check on the string length first, and then if they are the same length do a < check. -----Original Message----- From: Rick Emery [mailto:remery@excel.com] Sent: 12 February 2002 20:47 To: 'Mike'; php-db@lists.php.net Subject: RE: [PHP-DB] numeric string problem The question is: why use varchar? Why not use INT, then format to includes commas when displaying? -----Original Message----- From: Mike [mailto:mkinzie@tuxedojunction.ca] Sent: Tuesday, February 12, 2002 3:38 PM To: php-db@lists.php.net Subject: [PHP-DB] numeric string problem Hi, I am using VARCHAR for price column : 600,000 700,000 etc when I use : PRICERANGE<='$Price' it works fine except when the $Price moves to 7 digit as 1,000,000 in other words the" less than " does not work when comparing 6 digit and 7 digit figures I am not sure how to compensate for this. Thanks Mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.319 / Virus Database: 178 - Release Date: 28/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.319 / Virus Database: 178 - Release Date: 28/01/02

« previous php.db (#16891) next »