Jump to content

Table to Table?


tensionx

Recommended Posts

I am trying to build my DKP tracking tool. I have my beta up right now. My biggest conundrum is displaying my MySql table in an organized fashion with sort functions. my current out put is:


[code]$sql = "SELECT * FROM UFDKP";
$result = mysql_query($sql);
if ($myrow = mysql_fetch_array($result)) {
do
{

$USERID=$myrow["USERID"];
$Name=$myrow["Name"];
$Class=$myrow["Class"];
$SWR=$myrow["SWR"];
$RP=$myrow["RP"];
$Tier1=$myrow["Tier1"];
$Tier2=$myrow["Tier2"];
$Tier3=$myrow["Tier3"];
echo "<BR>USERID:  $USERID";
echo "<BR>NAME:  $Name";
echo "<BR>CLASS:  $Class";
echo "<BR>SWR:  $SWR";
echo "<BR>RP:  $RP";
echo "<BR>TIER 1:  $Tier1";
echo "<BR>TIER 2:  $Tier2";
echo "<BR>TIER 3:  $Tier3";
}
while ($myrow = mysql_fetch_array($result));
}
?>
[/code]
http://wekillmonsters.com/show.php
Its very dissapointing. lol
I tried a table Function
[code]
function GenerateTable($sqlResult, $Headers) {
                   $row = mysql_fetch_assoc($sqlResult);
                   $FieldList = Array_Keys($row);
                   echo "<table Border=2>";
                   Echo "<tr>";
                   For ($Cnt=0; $Cnt < Count($FieldList); $Cnt++) {
                            echo "<th>" . $Headers[$FieldList[$Cnt]] . "</th>";
                           }
                   echo "</tr>"; 
                   While ($row) {
                                 $RowColor = ($RowCnt % 2) ? "row1":"row2";
                                Echo "<tr>";
                                For ($Cnt=0; $Cnt < Count($FieldList); $Cnt++) {
                                         echo "<td class='$RowColor'>" . $row[$FieldList[$Cnt]] . "</td>";
                                        }
                                echo "</tr>"; 
                                $RowCnt++ ;
                                $row = mysql_fetch_assoc($sqlResult);
                                }
                    echo "</table>";                    } 
[/code]

I could not get it working. I am a beginner at this. The only thing I am confident in is my queries because thats my work.
If someone could point me in the write direction so I can figure out how to bring these 2 things together It would be much appreciated.

Thanks.
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.