• Resolved hsysgrp

    (@hsysgrp)


    I have tables with many fields that change values. One row either runs off the screen horizontally or fills the screen vertically. I would like to have the fields display vertically and then the next row display. I know I need a double loop; the inner foreach($results as $row){ works fine, I need help with the outer loop syntax that fetches the next row.
    row1
    field1
    field2
    field3
    etc.
    etc.
    row2
    field1
    field2
    field3
    etc.
    etc.
    Thank you.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter hsysgrp

    (@hsysgrp)

    Ask the question a different way. A test page.

    $sql = "SELECT * from AAUW_Desc order by LastName Limit 5;";			
    			if($result = mysqli_query($link, $sql)){    
    			if(mysqli_num_rows($result) > 0)
    			{        echo "<table>";            
    					echo "<title> <h1>Members Skills Table<h1></title>";   
    					while($row = mysqli_fetch_array($result)){ 
    		 echo "<tr><th>ID</th><td>{$row['ID']}</td></tr>";
            echo "<tr><th>First Name</th><td>{$row['FirstName']}</td></tr>";
            echo "<tr><th>Last Nname</th><td>{$row['LastName']}</td></tr>";
            echo "<tr><th>Date of Birth</th><td>{$row['Birth_Day']}</td></tr>";
            echo "<tr><th>Birth Month</th><td>{$row['Birth_Month']}</td></tr>";
            echo "<tr><th>Member Type</th><td>{$row['Mem_Type']}</td></tr>";
            echo "<tr><th>Honorary</th><td>{$row['Honorary']}</td></tr>";
            echo "<tr><th>Active</th><td>{$row['Active']}</td></tr>";
            echo "<tr><th>Joined Local</th><td>{$row['Joined_Local']}</td></tr>";
            echo "<tr><th>Joined Nat'l</th><td>{$row['Joined_Natl']}</td></tr>";
            echo "<tr><th>Mailings</th><td>{$row['Mailings']}</td></tr>";
            echo "<tr><th>Positions Held</th><td>{$row['Positions_Held']}</td></tr>";
            echo "<tr><th>Notes</th><td>{$row['Notes']}</td></tr>";
            echo "<tr><th>Referred Date</th><td>{$row['Referred']}</td></tr>";
            echo "<tr><th>Retired</th><td>{$row['Retired']}</td></tr>";
            echo "<tr><th>Employer</th><td>{$row['Employer']}</td></tr>";
            echo "<tr><th>Occupation</th><td>{$row['Occupation']}</td></tr>";
            echo "<tr><th>Positions</th><td>{$row['Positions']}</td></tr>";				
    					echo "</tr>";   
    					echo "<tr></tr>";
    					echo "</table>";             
    	 } 
           
        }
    			}

    The first row displays fine, the next 4 rows display with no formatting all together at the bottom of the screen. The table is not repeating, why not?

    • This reply was modified 4 years, 3 months ago by bcworkz. Reason: code fixed
    Moderator bcworkz

    (@bcworkz)

    Your closing </table> tag is within the loop with no new <table> to start another. The first <table> is before the loop starts. You can have a bunch of tables or one table, but be consistent where the open and closing tags occur ??

    Thread Starter hsysgrp

    (@hsysgrp)

    Thank you, thank you. Moved it one } down and it works like a charm, I just couldn’t see it.

    Moderator bcworkz

    (@bcworkz)

    Happy to help. Extra eyes are a wonderful thing ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Vertical results display’ is closed to new replies.