Jump to content

arrange in alphabetical order


madhuramasamy

Recommended Posts

i would like to have the chemical name arranged in alphabetical order when clicked on the title Chemical name( like a link that would change the order in ascending). but the problem is i get chemical id  from chem_inventory and chemical name from chemical acids (2 diff tables) . also count option is used with group by for chemical id . becaz of all this just order by option in statment 11 doesnot work. can someone suggest an alternative?

 

Thanks in advance!

 

<?php
include "basic.php";
include "header.php";
include "dbname.php";
dbconnect("","","","");
$query="select Chemical_ID, count(Chemical_ID) as Available from Chem_Inventory where Date_Out='0000-00-00' and (Chemical_ID>=1000 and Chemical_ID<2000) group by Chemical_ID ";
$result=mysql_query($query);
print "<h3><p><center>Microlab Chemical Inventory</center></p></h3><br>";         
print "<table><tr><td><b>Chemical ID</td><td><b>Chemical Name</td><td><b>Available Stock</td></tr>";
while ($sel = mysql_fetch_array($result)){
$query="select Chemical_Name from Chemicals_acids where Chemical_ID = '$sel[Chemical_ID]'";
$chems1 = mysql_query($query);
$chems = mysql_fetch_array($chems1);       
print "<tr><td>$sel[Chemical_ID]</td><td>$chems[Chemical_Name]</td><td>$sel[Available]</td></tr>";}
print "</table>\n";
print "<p><A href=\"search1.php\">Back</A></P>\n";
?>

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.