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
https://forums.phpfreaks.com/topic/208716-arrange-in-alphabetical-order/
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.