0

I'm working through pset 7, Every time I render and generate html in the controller it appears above the header on the generated page, I can't for the life of me get it to stop.

here's to code.

<?php

/Controller/

// configuration
require("../includes/config.php"); 


$rows = query("SELECT symbol, shares FROM shares WHERE id = ?", $_SESSION["id"]);   


// render portfolio
foreach ($rows as $row)

{
    print("<center><tr>");
    print("<td><p> Type of stock owned:</p>{$row["symbol"]}<br /><br /></td>");
    print("<td><p> Amount of this stock owned:</p>{$row["shares"]}</td>");
    print("</tr></center>");
}
render("portfolio.php", ["title" => "Portfolio"]);

?>

Thanks

picture

1

Ignore this,

It was actually fixed very easily by switching the order of the render function and the array loop.

Doh!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .