Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

mysql output modifications

Explorer ,
Jun 23, 2011 Jun 23, 2011

I am outputting my table data, and would like to modify it several ways.  One way is to check if the account status is set to 1, change the color to red and bold it.  also, i do not want to show the password field.  lastly, i would like to modify the table so that I can insert a Modify Account link.  here is what I have at the moment:

echo "<table border='3' cellpadding='5'><tr> <th>ID</th> <th>Name</th> <th>Username</th> <th>Password</th> <th>E-mail</th> <th>Account Activation</th> <th>Account Type</th> <th>Account Status</th> <th>Amount of Banwhitch Used</th> <th>Modify Account</th>";

for ($j = 0; $j < $rows; ++$j)
{
    $row = mysql_fetch_row($result);
    echo"<tr>";
    for ($k = 0; $k<9; ++$k)
    {
        echo "<td>$row[$k]</td>";
    }
    echo "</tr>";
}

echo "</table>";

thanks

TOPICS
Server side applications
386
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 26, 2011 Jun 26, 2011

future-architect wrote:

I am outputting my table data, and would like to modify it several ways.

Use conditional statements.

for ($j = 0; $j < $rows; ++$j)
{
    $row = mysql_fetch_row($result);
    echo"<tr>";
    for ($k = 0; $k<10; $k++)
    {
        // don't show password
        if ($k == 3) {
            echo "<td>******</td>";
        }
        // check status
        elseif ($k == 7 && $row[$k] == 1) {
            echo "<td style='color:red;font-weight:bold'>$row[$k]</td>";
        ]
        // create link
        elseif ($k == 9) {
            // create link using $row[0] (ID)
        }
        else {
            echo "<td>$row[$k]</td>";
        }
    }
    echo "</tr>";
}

Message was edited by: David_Powers amending code for password.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 26, 2011 Jun 26, 2011
LATEST

nevermind, got it to work

Message was edited by: future-architect

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines