sort contents of a field within record ...

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
pepe_lepew1962
Forum Commoner
Posts: 44
Joined: Thu Nov 20, 2008 10:29 am

sort contents of a field within record ...

Post by pepe_lepew1962 »

Hello:

When I call up a specific record, I need to sort the contents of "tblpartmanuf" and replace that field with the sorted information. Lets say the record is:

tblpartnumber tblpartmanuf
12544 GFSD

After I edit some other fields, automatically sort the tblpartmanuf field so that it is:
12544 DFGS




$sql="SELECT tblpartnumber, tblpartmanuf FROM tblparts WHERE tblpartnumber ='$frmpartfinder'";
$result = mysql_query($sql) or die('Error: ' . mysql_error());
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: sort contents of a field within record ...

Post by Christopher »

Code: Select all

$row['tblpartmanuf'] = implode('', sort(str_split($row['tblpartmanuf'])));
(#10850)
Post Reply