Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8328419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:26:18+00:00 2026-06-09T01:26:18+00:00

I want to take my users from my table and display them with a

  • 0

I want to take my users from my table and display them with a html table.i want their Name Avatar displayed. All of this information is in the table.
I want to display this in a table with 4 cols by as many rows needed.

This is my full code as asked for:

<html><head><title>MySQL Table Viewer</title></head><body>
<?php
$db_host = '';
$db_user = '';
$database = '';
$db_pwd = '';
$table = '';
if (!mysql_connect($db_host, $db_user, $db_pwd))
die("Can't connect to database");
if (!mysql_select_db($database))
die("Can't select database");
// sending query
$result = mysql_query("SELECT * FROM {$table} WHERE livedj=1");
if (!$result) {
die("Query to show fields from table failed");
}
$max_rows = 6;
$max_cols = 4;
echo "<table>";
$rows = 1;
while ($rows <= $max_rows)
{
echo "<tr>";
$cols = 1; // reset columns to 1 for each row
while ($cols <= $max_cols)
{
     echo "<td>". $row['name'] . "<br />
     <img src=\"http://myurl/path/to/pics/" . $row['avatar'] . "\" height=\"150\" width=\"150\" /></td>";
     $cols++; // column counter
}
echo "</tr>";
$rows++;  //row counter
}
echo "</table>";
?>
</body></html>

This only give out a page with the correct table made but it is not displaying any information from mysql…

and yes I have deleted the database and passwords settings here and my copy has the correct settings.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:26:20+00:00Added an answer on June 9, 2026 at 1:26 am

    I hope you meant to say your SQL table has 6 data fields (7 with the ‘livedj’ you seem to be using in your WHERE clause), and as many data entries as needed.

    I am also assuming you want your output to look something like this:

    +------+--------+-----------------------------+
    | Name | Avatar | Other stuff (email,fb,...)  |
    +------+--------+-----------------------------+
    | John | :-)    | blah                        |
    | ...  |  ...   | ...                         |
    +------+--------+-----------------------------+
    

    Then that code would be:

    <?php
    $result = mysql_query("SELECT name, address, twitter, email, facebook, avatar FROM {$table} WHERE livedj=1 ");
    if (!$result) {
    die("Query to show fields from table failed");
    }
    echo "<table border='1'>";
    
    while($row = mysql_fetch_array($result)){
      echo "<tr><td>".$result["name"]."</td><td>"
      ."<img alt='avatar' src='path/to/img/folder/".$result["avatar"]." /></td><td>"
      .$result["address"]."</td><td>".$result["email"]."</td><td>"
      .$result["twitter"]."</td><td>".$result["facebook"]"</td></tr>\n";
    }
    echo "</table>
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this function that takes all the users from an MySql table
What if I want to take user input from the args[0] array, but just
Requirement is like: I want to take input values from user in frame but
I want to help user to take their pictures with a plugged in video
I want to display for the user how long ago this record was added.
After dynamically creating a client-side table based on SELECT information retrieved from MySql database,
I'm trying to make a calculator that will take inputs from users and estimate
When my users log into the website their first name, last name and ID
I have a MySQL table for competitions called users . Now, I want to
Is there an elegant way to take the phpbb user table from the version

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.