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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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