Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

Recommended Posts

I have two columns in a table that are set to organize by ASC or DESC.

The issue is that ASC shows 1000 before 9 because it goes by the first digit.

 

// Sort Url
function SortUrl(&$fld) {
	if ($this->CurrentAction <> "" || $this->Export <> "" ||
		($fld->FldType == 205)) { // Unsortable data type
		return "";
	} else {
		$sUrlParm = $this->UrlParm("type=" . mysql_real_escape_string($_GET['type']) . "&order=" . urlencode($fld->FldName) . "&ordertype=" . $fld->ReverseSort());
		return ew_CurrentPage() . "?" . $sUrlParm;
	}
}

 

That's the code that's sorting (I think)

Any help would be awesome!

Link to comment
https://forums.phpfreaks.com/topic/158062-organize-by-number-issue/
Share on other sites

Well, as someone and I have stated numerous times, that just builds the query string. You really don't need to touch that in your system. Not sure why you're so attached to it.

 

Anyways, I'm going to assume that whatever you're sorting by is NOT of type int, am I right?

It's actually VARCHAR.

That's my problem isn't it?

 

If I change the table value type to INT will that mess up the data already in the table?

 

EDIT: Damnit. I made the change and all my years changed to 127.

I've got a long night ahead of me.

 

Anyway to change the table type without screwing it up.

Yes, I was stupid enough not to backup the table because I thought I had a backup, but it's not current.

Uh, what field are you changing? What kind of data does that column hold?

The fields are both VARCHAR and I use PHPMyAdmin.

They both currently hold numbers, like 105000 or 4500 which are formatted when they are displayed to be the correct format. There is no punctuation, decimals, etc only numbers.

 

Thanks!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.