0

My sell.php file renders sell_form.php but when I submit some stock symbol I don't get anything but reload of the same file. I can't figure out why. Can someone help me with this?

// Code deleted

And sell_form.php looks like:

// Code deleted

1 Answer 1

0

This is the only code that will execute.

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

$rows = CS50::query("SELECT id FROM portfolios WHERE user_id = ?", $_SESSION["id"]);

if ($rows == false)
{
    apologize("You don't have any stocks to sell.");
}
else
{
    render("sell_form.php", ["title" => "Sell"]);

When the program takes the else branch, it renders sell_form.php. It will never execute the rest of the code.

3
  • Yeah, that was a problem. And after I deleted this part of the code it works fine. But, do you know why is it like that?
    – user10787
    Commented Feb 27, 2016 at 12:53
  • When the program executes the render it calls sell_form.php. It querys for rows again, and on success it calls sell_form.php. It querys for rows again, and on success it calls sell_form.php. It querys for rows again, and on success it calls sell_form.php.......... Commented Feb 27, 2016 at 14:24
  • Ah, now I get it. Thanks for the explanation. :)
    – user10787
    Commented Feb 27, 2016 at 19:24

You must log in to answer this question.