Re: [PHP-DB] Sorting issue

2003-08-14 Thread David T-G
Jeff --

...and then Jeff said...
% 
% One last question.
% 
% I changed all the DB values where numbers are used - (varchar - int)

Well, you should only change for those where the numbers are numbers...


% 
% But for the well locations, there are dashes in them, I.E. 10-15-065-22

Exactly.


% 
% With setting the field to int, it only displays the first part.
% 10-15-065-22 shows as 10
% There are also several other fields that use dashes.

Then those are an alphanumeric mixture and should be a varchar.


% 
% If I set it back to varchar, will it sort it right because the numbers are
% separated by an alfa character, or will I have the same problem as before?

If the numbers are padded then it will sort right.  That is, is the 065
holding three places with a zero?  If it's always 2-2-3-2 digits then
sorting will be just fine (just like 00055 would have sorted as you
expected against 14000 in a varchar field).


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP-DB] Sorting issue

2003-08-14 Thread Jeff
Yes duh...

I didn't realize numbers weren't considered characters.
What's the sql entry for numeric characters?

I'm new at this, and figure I'm not doing to bad so far. .

John W. Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Jeff wrote:

  kwo VARCHAR(10) NOT NULL,
  lsd VARCHAR(20) NOT NULL,

 duh

 --
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 PHP|Architect: A magazine for PHP Professionals – www.phparch.com







-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Sorting issue

2003-08-14 Thread John W. Holmes
Jeff wrote:

Yes duh...

I didn't realize numbers weren't considered characters.
What's the sql entry for numeric characters?
I'm new at this, and figure I'm not doing to bad so far. .
Make them an INT column. It'll hold numbers up to 2 billion+. Or you can 
use TINYINT which will hold numbers up to 255. Read the MySQL docs for 
more column types...

kwo INT NOT NULL,
lsd INT NOT NULL,
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Sorting issue

2003-08-14 Thread Fernando Soto






This would happens ifyou have defined the data type of the columns as char or varchar.


---Original Message---


From: Aaron Wolski
Date: Viernes, 08 de Agosto de 2003 08:51:04 a.m.
To: 'Jeff'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Sorting issue

Seeing code might help us.

Aaron

 -Original Message-
 From: Jeff [mailto:[EMAIL PROTECTED]]
 Sent: August 8, 2003 10:44 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Sorting issue

 Why would a mysql db think that 55 was greater than 14000.

 I have several headings that display sql data under them, when you
click
 on
 the heading, it sorts that section (descending/ascending), but it only
 seems
 to be looking at the first two numbers in the one heading. Is there
a
 command that forces it to look at the entire record before sorting it?

 Thanks
 Jeff



 --
 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


.







 IncrediMail - Email has finally evolved - Click Here

Re: [PHP-DB] Sorting issue

2003-08-14 Thread John W. Holmes
Jeff wrote:

kwo VARCHAR(10) NOT NULL,
lsd VARCHAR(20) NOT NULL,
duh

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Sorting issue

2003-08-14 Thread Jeff
The MySQL script I made,

CREATE TABLE cnrl_db (
gradient MEDIUMINT(10) NOT NULL AUTO_INCREMENT,
kwo VARCHAR(10) NOT NULL,
lsd VARCHAR(20) NOT NULL,
date DATE DEFAULT '-00-00' NOT NULL,
well VARCHAR(50) NOT NULL,
field VARCHAR(25) NOT NULL,
uni VARCHAR(30) NOT NULL,
license VARCHAR(10) BINARY NOT NULL,
formation VARCHAR(20) NOT NULL,
perfs VARCHAR(20) NOT NULL,
event VARCHAR(1) NOT NULL,
fluid VARCHAR(2) NOT NULL,
mode VARCHAR(2) NOT NULL,
type VARCHAR(2) NOT NULL,
vhd VARCHAR(10) NOT NULL,
file VARCHAR(15) NOT NULL,
kb VARCHAR(6) NOT NULL,
grd VARCHAR(10) NOT NULL,
open VARCHAR(1) NOT NULL,
sour  VARCHAR(1) NOT NULL,
tube VARCHAR(10) NOT NULL,
landed VARCHAR(6) NOT NULL,
casing  VARCHAR(6) NOT NULL,
landed2 VARCHAR(6) NOT NULL,
shut_date VARCHAR(10) NOT NULL,
shut_time VARCHAR(10) NOT NULL NOT NULL,
pres VARCHAR(15) NOT NULL,
tag VARCHAR(15) NOT NULL,
PRIMARY KEY (gradient)
);
  Fernando Soto [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
This would happens if you have defined the data type of the columns as char or 
varchar.


---Original Message---

From: Aaron Wolski
Date: Viernes, 08 de Agosto de 2003 08:51:04 a.m.
To: 'Jeff'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Sorting issue

Seeing code might help us.

Aaron

 -Original Message-
 From: Jeff [mailto:[EMAIL PROTECTED]
 Sent: August 8, 2003 10:44 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Sorting issue

 Why would a mysql db think that 55 was greater than 14000.

 I have several headings that display sql data under them, when you
click
 on
 the heading, it sorts that section (descending/ascending), but it only
 seems
 to be looking at the first two numbers in the one heading. Is there
a
 command that forces it to look at the entire record before sorting it?

 Thanks
 Jeff



 --
 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


. 
   
   
  
IncrediMail - Email has finally evolved - Click Here

Re: [PHP-DB] Sorting issue

2003-08-14 Thread John W. Holmes
Jeff wrote:

kwo isn't sorting properly... actually, I need to retest the lsd column too.
Can you answer the question we ask please? It's already been pointed out 
to you several times that a CHARACTER column is going to sort in the 
manner you found while an INTEGER column will not. So, you MUST be using 
a VARCHAR, CHAR, or similar text column when you should be using a 
numeric column for numeric values...

Have a nice day.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Sorting issue

2003-08-11 Thread Fernando Soto







You have to change 

kwo VARCHAR(10) NOT NULL,

for 

kwoint(10) NOT NULL,

Hope this helps

Fernando Soto




From: Jeff
Date: Viernes, 08 de Agosto de 2003 10:36:33 a.m.
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Sorting issue

Yes duh...

I didn't realize numbers weren't considered characters.
What's the sql entry for numeric characters?

I'm new at this, and figure I'm not doing to bad so far. .

"John W. Holmes" [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 Jeff wrote:

  kwo VARCHAR(10) NOT NULL,
  lsd VARCHAR(20) NOT NULL,

 duh

 --
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 PHP|Architect: A magazine for PHP Professionals – www.phparch.com







--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


.







 IncrediMail - Email has finally evolved - Click Here

RE: [PHP-DB] Sorting issue

2003-08-09 Thread Aaron Wolski
Seeing code might help us.

Aaron

 -Original Message-
 From: Jeff [mailto:[EMAIL PROTECTED]
 Sent: August 8, 2003 10:44 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Sorting issue
 
 Why would a mysql db think that 55 was greater than 14000.
 
 I have several headings that display sql data under them, when you
click
 on
 the heading, it sorts that section (descending/ascending), but it only
 seems
 to be looking at the first two numbers in the one heading.   Is there
a
 command that forces it to look at the entire record before sorting it?
 
 Thanks
 Jeff
 
 
 
 --
 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



Re: [PHP-DB] Sorting issue

2003-08-09 Thread Jeff
kwo isn't sorting properly... actually, I need to retest the lsd column too.


John W. Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Jeff wrote:

 $query = SELECT kwo, lsd, date, event FROM $gradient_tablename
$order_by_str $sort_order_str
$limit_str;

 So what column is not sorting correctly? Is the column a INTEGER-type
 column or a CHARACTER-type column...

 Again:
 55  14000
 55  14000

 --
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 PHP|Architect: A magazine for PHP Professionals – www.phparch.com







-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Sorting issue

2003-08-09 Thread Jeff
Seems like changing the mixed fields back to VARCHAR worked!

Thanks again guys!

David T-G [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Sorting issue

2003-08-08 Thread Jeff
Thank you EVERYONE.. AGIAN!  *grin*



John W. Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Jeff wrote:

  Yes duh...
 
  I didn't realize numbers weren't considered characters.
  What's the sql entry for numeric characters?
 
  I'm new at this, and figure I'm not doing to bad so far. .

 Make them an INT column. It'll hold numbers up to 2 billion+. Or you can
 use TINYINT which will hold numbers up to 255. Read the MySQL docs for
 more column types...

 kwo INT NOT NULL,
 lsd INT NOT NULL,

 --
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 PHP|Architect: A magazine for PHP Professionals – www.phparch.com







-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Sorting issue

2003-08-08 Thread John W. Holmes
Jeff wrote:

   $query = SELECT kwo, lsd, date, event FROM $gradient_tablename
  $order_by_str $sort_order_str $limit_str;
So what column is not sorting correctly? Is the column a INTEGER-type 
column or a CHARACTER-type column...

Again:
55  14000
55  14000
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Sorting issue

2003-08-08 Thread John W. Holmes
Jeff wrote:
One last question.

I changed all the DB values where numbers are used - (varchar - int)

But for the well locations, there are dashes in them, I.E. 10-15-065-22

With setting the field to int, it only displays the first part.
10-15-065-22 shows as 10
There are also several other fields that use dashes.
If I set it back to varchar, will it sort it right because the numbers are
separated by an alfa character, or will I have the same problem as before?
It will sort as a string, which is what it is. Maybe you should take the 
dashes out and only add them back in for display purposes? Or have two 
columns, one with the display value and one with the integer value 
where the dashes have been removed.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Sorting issue

2003-08-08 Thread David T-G
Jeff --

...and then Jeff said...
% 
% Yes duh...

*grin*


% 
% I didn't realize numbers weren't considered characters.
% What's the sql entry for numeric characters?

Integer looks like it will do the trick for you.


% 
% I'm new at this, and figure I'm not doing to bad so far. .

I know what you mean :-)  Spend a *lot* of time with the manual!


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature