Jump to content


Photo

Table to Table?


  • Please log in to reply
2 replies to this topic

#1 tensionx

tensionx
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 01 August 2006 - 09:31 PM

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:


$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));
}
?>
http://wekillmonsters.com/show.php
Its very dissapointing. lol
I tried a table Function
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>";                    }  

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.

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 01 August 2006 - 09:36 PM

Can you kindly tell me what look you want outputted cheers.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 tensionx

tensionx
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 01 August 2006 - 09:54 PM


<b>Name</b>

Bob
Steve
Mark
Sara
John
[/table]

7 columns
the primary key is the userid
Sorts tied to the primary key.
Side by side like an excel spreadsheet hehe






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users