I have a php/mysql search of product inventory. All of the products are stored in the database as records. Each record (product) has several characteristics(columns). You are only able to search the records by 4 of the columns. This works fine. The problem I am having is with the sorting of the results. One of the columns follows no logical alpha/numeric sorting but there is a definite way it should be sorted. For searching this column, I have made another column with a number variable 1-9 representing highest to lowest and used the search label to represent the correct variable. The results that are displayed, though correct, are the actual variable and I can not get it to sort lowest to highest. I apologize, I am not a coder, and I know I am not describing this well. Your solution must not drastically change the system i am using. It may be bass ackwards, but it works for us and we can update it with ease. Please PM me for details. I really appreciate all responses. Payment is by paypal only. Thank you! P.S. Also posted in contests
my first thought is maybe also not good coding create a new table called tmp results. Store your search results in it. make a loop to identify the number of your second table and insert the values. When this is done echo the result with sorting on the secondtable values and drop the values of the tmp resultstable. Make sure that you have a key in the tmp table that will identify records from a search result that belong together and use that in your query and drop.
Hi Edynas, Thanks for your response. Maybe the coding is not so good, but even in excel, just trying to sort the column doesn't work because there is no logic to the best-worst order. Thanks for your advice on the remedy, but this is beyond my capabilities and why i am offering $ for someone to either explain it clearly or do it for me. I am even flexible with the money offered.
It sounds simple but I am having trouble interpreting exactly what your trying to say. It sounds like you have something like this 1=>'some illogical value' 2=>'another value' etc all the way to nine. Then you are using the numbers 1-9 to fetch the right records? So when you get your results is it all one number? For example you return everything for number 1 and display its related value ? Please try to be a little more specific in your description.
could you provide an example what is in the tables, how the ourput must look like, maybe that will be easier to help you