0

I have a database and I am trying to display data from the table all in one box.

I am not sure if there is another way besides tables but I am trying to do something like this.

I am using roblox as an example.

Example:
Example

Right now this is my code for the table.

                    <div class="row2">
  <div class="column">
  <?php
                    include_once("includes/config.php");
        $sql = "SELECT * FROM communities";  
        $result = $conn->query($sql);
        if ($result->num_rows > 1) {
            while($row = $result->fetch_assoc()) {
                echo '<hr />';
                echo '<table>';
                echo '<tr><td>Name: </td><td>'.$row["name"].'</td></tr>';
                echo '<tr><td>Discription:</td><td>'.$row["description"].'</td></tr>';
                echo '<tr><td></td><td><img src="'.$row["logo"].'" width="100px" /></td></tr>';
                echo '</table>';
                echo '<button name="button">Join</button>';
                echo '<hr />';
            }
        }       
                ?>
  </div>
Littm
  • 4,923
  • 4
  • 30
  • 38
  • What is `
    `?
    – Kunal Raut May 08 '20 at 14:45
  • Its to make a line – Devin Henrickson May 08 '20 at 14:49
  • To make a horizontal rule we use
    not
    – Kunal Raut May 08 '20 at 14:50
  • Look I am new to coding and just looking for some help – Devin Henrickson May 08 '20 at 14:59
  • @DevinHenrickson Your code creates a new table for every row from the database. Is this intentional? – GrumpyCrouton May 08 '20 at 15:01
  • @GrumpyCrouton Ohh! ok thanks. – Kunal Raut May 08 '20 at 15:02
  • @GrumpyCrouton I do not know what I am doing. The code is something I was just trying to do to help me display the data it was supposed to display. Now I am trying to make it into boxes like roblox and display the data like that. Where every new row is a new box or something like that/ – Devin Henrickson May 08 '20 at 15:15
  • @Kunal Raut - hr is analog to br (https://stackoverflow.com/questions/1946426/html-5-is-it-br-br-or-br) Yes, it is possible to write
    . The slash is not needed but it is no fault and it was rude to ask this question and not help Devin with his problem ... Devin Henrickson: You can change each table into a DIV-construct. But what is your concrete question and where are you stuck?
    – Melvin May 08 '20 at 15:27
  • @DevinHenrickson Sounds like you are looking for a CSS framework. – GrumpyCrouton May 08 '20 at 15:27
  • @Melvin What I am stuck on is the ability to make the data appear horizontally. On my test site you can see how the data is located. I want it like that but appears horizontally. So instead of it going down, I want it to progress to the side. http://testingsite1.devinhenrickson.com/ – Devin Henrickson May 08 '20 at 15:35
  • @Devin Henrickson OK. If you want to add several items horizontally you need something to scroll the items horizontal or you make sure the items can't "grow" out on the right side of your browser. It's possible to add a certain amount of items, then add a line-break and start the next item-line. Or you have something with a slider which can grow indefinitly to the right. (simplest form is the iframe) – Melvin May 08 '20 at 17:22
  • @Melvin I think your correct with that about CSS framework. Davin, try with CSS framework like Bootstrap. colomn and row class may be help you. – Lakmal Bodhinayaka May 08 '20 at 17:22

0 Answers0