![]() |
sort the contents for a record field ...
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()); |
I don't think that MySQL has a function for string sorting, but php does, so you can do a retrieving query, then sort the string, then make an update query. For a simple example (and not tested or strong in security):
php Code:
This is a quick example and again not very good for production since it doesn't take into account query performance and security. But an example of using array sorting for string sorting by using usort |
| All times are GMT. The time now is 07:45 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0