Jump to content

ivyleong

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ivyleong's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, i am doing a thesis to enhance a database under my University server. I need to change the static table after the search page to a dynamic one where users can view data by sorting any column they like by click on the column name. I have no idea on it, anyone can help me? Thanks. The original coding is too complex and make me, a starter blur on it, hopefully you can understand it and please help me and tell me where should i correct it.. Thanks, cheers <? $cat=$_POST['cat']; $subcat=$_POST['subcat']; $subcat3=$_POST['subcat3']; $quer="MF"; $quer2="MP"; $quer3="Others"; $query="SELECT * FROM `$subcat3`"; //MySQL query $numresults = mysql_query ($query) or die ( "<center>Couldn't execute query<center>" ); //$row= mysql_fetch_array ($numresults); if ($subcat== $quer) { echo "<center><h1> <i>" . $subcat3 ."</i> </center></h1>"; //display results in tabular format echo " <table width=774 align=center height=69 border=1 bordercolor=#000000> <tr bordercolor=1 bgcolor=#0099FF> <td width=148><div align=center class=style7><strong><span class=style2>Sample_ID</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>Taxcode</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>SL</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>TL</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>BD</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>WT</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>Sex</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>Mat</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>Time</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>Gear</span></strong></div></td> </tr>"; while ($row= mysql_fetch_array ($numresults)){ //loop until all records from the table are selected echo "<tr bordercolor=1>"; echo "<td>". $row[ 'SAMPLE_ID' ] ."</td>"; echo "<td>". $row[ 'TAXCODE' ] ."</td>"; echo "<td>". $row[ 'SL' ] ."</td>"; echo "<td>". $row[ 'TL' ] ."</td>"; echo "<td>". $row[ 'BD' ] ."</td>"; echo "<td>". $row[ 'WT' ] ."</td>"; echo "<td>". $row[ 'SEX' ] ."</td>"; echo "<td>". $row[ 'MAT' ] ."</td>"; echo "<td>". $row[ 'TIME' ] ."</td>"; echo "<td>". $row[ 'GEAR' ] ."</td>"; echo "</tr>";} echo "</table>"; echo "<center><h3>Click on the link to view as Excel file: <a href='excel/". $subcat3 .".xls'>". $subcat3 ."</a></h3>"; //Link to Excel file echo "<center><input type=button value='Search another record' onClick=goToURL()></center>";} if ($subcat== $quer2) // If category selected from page "search3.php" is the same as the values given { echo "<center><h1> <i>" . $subcat3 ."</i> </center></h1>"; //display results in tabular format echo " <table width=774 align=center height=69 border=1 bordercolor=#000000> <tr bordercolor=1 bgcolor=#0099FF> <td width=148><div align=center class=style7><strong><span class=style2>Sample_ID</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>Taxcode</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>NO</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>CL</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>WT</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>SEX</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>MAT(gm)</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>Gear</span></strong></div></td> </tr>"; while ($row= mysql_fetch_array ($numresults)){ //loop until all records from the table are selected echo "<tr bordercolor=1>"; echo "<td>". $row[ 'SAMPLE_ID' ] ."</td>"; echo "<td>". $row[ 'TAXCODE' ] ."</td>"; echo "<td>". $row[ 'NO' ] ."</td>"; echo "<td>". $row[ 'CL' ] ."</td>"; echo "<td>". $row[ 'WT' ] ."</td>"; echo "<td>". $row[ 'SEX' ] ."</td>"; echo "<td>". $row[ 'MAT' ] ."</td>"; echo "<td>". $row[ 'GEAR' ] ."</td>"; echo "</tr>";} echo "</table>"; echo "<center><h3>Click on the link to view as Excel file: <a href='excel/". $subcat3 .".xls'>". $subcat3 ."</a></h3>"; //Link to Excel file echo "<center><input type=button value='Search another record' onClick=goToURL()></center>";} if ($subcat== $quer3)// If category selected from page "search3.php" is the same as the values given { echo "<center><h1><i>" . $subcat3 ."</i> </center></h1>"; //display results in tabular format echo " <table width=774 align=center height=69 border=1 bordercolor=#000000> <tr bordercolor=1 bgcolor=#0099FF> <td width=148<div align=center class=style7><strong><span class=style2>Date</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>Month</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>Time</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>Taxcode</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>Sample_ID</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>SL</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>TL</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>BD</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>WT</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>Sex</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>MAT</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>Gear</span></strong></div></td> <td width=148<div align=center class=style7><strong><span class=style2>Record</span></strong></div></td> <td width=148><div align=center class=style7><strong><span class=style2>CL</span></strong></div></td> </tr>"; while ($row= mysql_fetch_array ($numresults)){ //loop until all records from the table are selected echo "<tr bordercolor=1>"; echo "<td>". $row[ 'DATE' ] ."</td>"; echo "<td>". $row[ 'MONTH' ] ."</td>"; echo "<td>". $row[ 'TIME' ] ."</td>"; echo "<td>". $row[ 'TAXCODE' ] ."</td>"; echo "<td>". $row[ 'SAMPLE_ID' ] ."</td>"; echo "<td>". $row[ 'SL' ] ."</td>"; echo "<td>". $row[ 'TL' ] ."</td>"; echo "<td>". $row[ 'BD' ] ."</td>"; echo "<td>". $row[ 'WT' ] ."</td>"; echo "<td>". $row[ 'SEX' ] ."</td>"; echo "<td>". $row[ 'MAT' ] ."</td>"; echo "<td>". $row[ 'GEAR' ] ."</td>"; echo "<td>". $row[ 'Record' ] ."</td>"; echo "<td>". $row[ 'CL' ] ."</td>"; echo "</tr>";} echo "</table>"; echo "<center><h3>Click on the link to view as Excel file: <a href='excel/". $subcat3 .".xls'>". $subcat3 ."</a></h3>"; //Link to Excel file echo "<center><input type=button value='Search another record' onClick=goToURL()></center>";} ?>
×
×
  • 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.