Jump to content

Sorting data on page


GremlinP1R

Recommended Posts

Hi There

I have now with a lot of effort and a huge script got to a point I just have to sort some data.
But now I cant use the Order by in the mysql_query as the number it sould be sorted by is after all the proceses. I have got a $d_id that = to a 2digit number. How do I sort information only using the page and not the database?

using $row = mysql_fetch_array() to display  all data on page!

Please help if possible. Thanx
Link to comment
https://forums.phpfreaks.com/topic/23575-sorting-data-on-page/
Share on other sites

hehe Daniel where not on the same wave lenght here, wait let me try again.

Okay I'm using a search function to search the data base for a sertian part of a 13digit number

if (isset($_POST['Get'])){
  if ($select == Num32){$result = mysql_query("SELECT * FROM table WHERE row LIKE '__32_________' ORDER BY row ASC ") or die();}
  elseif ($select == Num27){$result = mysql_query("SELECT * FROM table WHERE row LIKE '__27_________' ORDER BY row ASC ") or die();}

then after that I'm getting it to show but with a twist that digit is a 13digit numer searching using position 3 and 4 op the number. There after I I put it on the page.

// keeps getting the next row until there are no more to get
      while($row = mysql_fetch_array( $result )){
  // Print out the contents of each row into a table
      echo "<form action='individualsdetaiils.php' method='post'>";
        $ref = $row['ID'];
$bid = $row['idno'];
if ($bid != 0){
$d_id = $bid{4}.$bid{5};
$m_id = $bid{2}.$bid{3};
if ($m_id == 1){$m_id = one;}
elseif ($m_id == 2){$m_id = two;}
elseif ($m_id == 3){$m_id = three;}
elseif ($m_id == 4){$m_id = four;}
          echo "</td><td>";
          echo $row['Names'];
  echo "</td><td>";
  echo "$d_id $m_id";
  echo "</td><td>";

Now what I want to do is sort by $d_id that is created here after the query. the $d_id is position 5 and 6 in the 13digit number.
Link to comment
https://forums.phpfreaks.com/topic/23575-sorting-data-on-page/#findComment-107046
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.