Tip:
Highlight text to annotate it
X
SPEAKER 1: Now let's make some money by selling some stocks.
To sell a stock, a user can only really sell a stock that they
themselves own.
So you're going to display the form where you obtained the stock that the
user wants to sell, remove that stock from their portfolio, and update the
user's cash.
>> The template for selling stocks should be a form where the user can choose
which stock to sell, but only if that stock is one that they own.
So you can select from your portfolio where the given user's ID is the
session ID.
Then removing the stock from the portfolio--
well, that's just the DELETE FROM SQL query.
>> Finally, updating cash--
well, the stock is sold at its current price, so look back to the SQL query
that you used for buy and edit that.