I have the following lines:
1BG200,1M400,1BA1000
And I want to compare the given lines in Desc Order ...
code:
$sql = "SELECT * FROM collected WHERE c_no BETWEEN '".$from."' AND '".$to."' ORDER BY c_no Desc";
Output:
1M400 1BG200 1BA1000
It should be 1000 more, and then 400, 200. How can you compare them? I believe that it is not correct to compare a string containing an integer! And I canβt find the right solution for my problem?
Some people suggested using preg_match or substr .. But, as you can see, there are single and double ex characters (M and BG).
Sorry, I am not familiar with PHP .. Please help!
source share