Questions tagged [sell]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
318 views

Cannot get drop down menu to display for pset7. Why would this be?

I have set up a template form that sends the symbol selected by the user to the controller. I cannot get the form to show when I request the page. Here is my code for the form: <form action="...
ascar's user avatar
  • 23
2 votes
1 answer
77 views

Pset7 How to Program Popup?

I'm trying to create a popup after a user successfully sells a stock. I want it to look like Chrome's confirm form resubmission popup I'm pretty sure I need javascript, html, and css, but I'm not ...
i_am_david's user avatar
  • 1,211
1 vote
1 answer
1k views

CS50 PSET7 Finance: in SELL; expected to find select field with name "symbol", but none found

My CS50 finance app passes all check50 tests except just one in the SELL component. I just can't find the error and need thoughts/ideas / tried a lot ( read: a-lot). My code was created in 2017 and ...
Peter Laidlaw's user avatar
1 vote
2 answers
100 views

Array in php vs R (pset7 sell.php)

Ok, I'm at pset7 (C$50 Finance), more specifically trying to implement sell.php. I have created a template, sell_form.php, where users can select the symbol of the stock they want to sell and ...
Cyborg101's user avatar
1 vote
1 answer
161 views

pset7 sell.php Fatal error: You have an error in your SQL syntax

I can't find my mistake for a few hours already, and I keep getting the same error: Fatal error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version ...
Vitale's user avatar
  • 235
1 vote
0 answers
307 views

Update Cash in "sell.php" is Not Working

Everything is working file but the cash is not updating. I think its due to typecasting. The value for shares is an integer and price is a float-point integer but I'm confused as to how to cast them. ...
avishek arora's user avatar
1 vote
1 answer
88 views

Convert sold shares to an INT - PSET7

When I query my Database for the number of shares of some user, I get a strange value when converting this value to an int or a float. For instance, my query should return the value of "100" shares ...
Juan Carlos Piñeros's user avatar
0 votes
1 answer
386 views

Pset7 undefined index

I'm getting this error in sell.php - Notice: Undefined index: shares in /home/jharvard/vhosts/pset7/public/sell.php on line 20 My code :- <?php // configuration require("../includes/...
Jedi18's user avatar
  • 17
0 votes
1 answer
315 views

pset7 sell.php doesn't sell stocks or change cash

I'm done with pset7 but my sell.php never updates the portfolio table when I sell stocks. it only displays the drop-down menu correctly where it shows the stocks bought in the list, but when i choose ...
Riham Nour's user avatar
0 votes
1 answer
743 views

How to create a drop-down menu that contains the stocks that has as options?

I'm struggling trying to create the form for this part of the pset. I have a controller (sell.php) and a template form (sell_form.php). Sell.php receives submission from sell_form.php, delete user 's ...
FranGoitia's user avatar
0 votes
1 answer
66 views

pset 9 finance :( sell page has all required elements

i searched around for this type of error and looked at my code, but was not able to figure it out. I had something very similar when debugging the buy function and used a similar process for the sell ...
Xenoshell's user avatar
0 votes
1 answer
18 views

can't seem to figure out the problem with the sell route code

can't seem to figure out the problem with the sell route code that check50 indicates this is my sell route code: @app.route("/sell", methods=["GET", "POST"]) @...
Michael's user avatar
0 votes
1 answer
487 views

pset 8 finance: :( sell handles valid sale

:) Struggle with the last check. Get this error message: expected to find "56.00" in page, but it wasn't found Tried the same approach like I used for the buy-function. Create an extra template to ...
Dawienchi's user avatar
0 votes
1 answer
106 views

pset8 finance: Problem with calculaton for "/sell"

I'm implementing the "sell" function and have a problem with the calculation of the new value for "share" and "cash". Here is my code: @app.route("/sell", methods=["GET", "POST"]) @login_required ...
Dawienchi's user avatar
0 votes
1 answer
384 views

PSET7 Finance- Quote and Buy not passing all checks

I've just come back to CS50 after the semester ended and have been trying to debug my program to no avail. The application appears to be working when I test it myself, passes all checks, but has ...
Billy Currie's user avatar
0 votes
1 answer
41 views

Pset7 Sell stockprice not a bound parameter

I'm working on sell, and I ran into trouble in one of my db.execute statements. For whatever reason, in the previous line, it was perfectly fine using stock["price"] but in my second db.execute, it ...
Joel Banks's user avatar
0 votes
1 answer
156 views

after using style50 and correcting my spaces etc I ran my code again and got this error which makes no sense to me. need some help please?

def buy(): """Buy shares of stock""" if request.method == "GET": return render_template("buy.html") else: info = lookup(request.form.get("symbol")) if not info: return apology("...
user21692's user avatar
0 votes
1 answer
197 views

problem , yet again in pset7 . my sell page works fine but check50 shows me something else O.o

def sell(): """Sell shares of stock""" # method check if request.method == "GET": return render_template("sell.html") else: # valid name info = lookup(request.form.get("symbol")) if ...
user21692's user avatar
0 votes
2 answers
150 views

pset 7 sell Type Error 'NoneType' object

I am working on sell and I am getting an error: "TypeError: 'NoneType' object is not subscriptable" on the variable "price". I am not sure why as this is more or less the exact same code I have in buy ...
CM23's user avatar
  • 21
0 votes
1 answer
308 views

pset7 sell: can not make drop down menu work

i can not get why drop down menu does not work. It seems that the list is empty, but when I check it in another program, it contains information as expected. I just don't get why the dorpdown list is ...
andy's user avatar
  • 11
0 votes
1 answer
46 views

pset7 sell.php I seem to be missing something

I just finished sell.php, but I had to use $cash[0]["cash"], to get cash out of my query. This dos not feel right. The code works, but I feel it is wrong. Is there a better way to do this?? <?...
William Cullian's user avatar
0 votes
1 answer
63 views

Pset7 pass data to drop down bottom

I'm now trying to make the sell button, and have a problem. I try to do the query from data base just like index.php did. And then I transfer the $rows results to sell_form.php(where show the button). ...
TwDreamer's user avatar
0 votes
1 answer
51 views

pset7 unsupported operand types

I am wrestling with an "unsupported operand error". According to Stack Overflow the problem is that I am trying to do math with an array but doesn't $ticker[0]["shares"]; refer to a single data point ...
Brendan Rafferty's user avatar
0 votes
1 answer
49 views

sell.php doesn't return error when the stocks doesn't exist in the user's portfolio

<?php require("../includes/config.php"); if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["stock"])) { apologize("You must provide the stock you want to sell."); } ...
Mahmoud Khaled's user avatar
0 votes
1 answer
81 views

I am currently working on sell.php. I have debugged the code several times but I am unable to find the error.?

Sell.php // if user reached page via GET (as by clicking a link or via redirect) if ($_SERVER["REQUEST_METHOD"] == "GET") { // else render form $rows = CS50::query("...
Anirudh Thatipelli's user avatar
0 votes
1 answer
64 views

pset7 sell: MVC problem

I can't seem to connect my sell_index.php (Where I get the symbols in with query) with my view, sell_form.php, because $symbols is empty. I have sell working if I directly get symbols in sell_form.php,...
Useful_Investigator's user avatar
0 votes
1 answer
197 views

Pset7 - Issue with updating cash in sell.php

I wrote some code for sell.php in CS50 Finance, but the cash field in the users table does not update accurately. The code for updating this field is towards the bottom. This is really driving me ...
grparker21's user avatar
0 votes
1 answer
106 views

Pset7 Sell.php not adding money to users

I have been working on the sell page for Pset 7. I have it so when i sell it removes the proper stock from the portfolios database. But for some reason it is not updating the cash in the users ...
Bogricia's user avatar
0 votes
1 answer
108 views

pset7 sell controller issue: undefined index

I have been working at trying to fix an issue I have been having with a variable. I keep getting an error for an undefined index for value on line 49: // update cash upon selling stock query("UPDATE ...
peachykeen's user avatar
0 votes
1 answer
301 views

sell.php doesn't update cash and does sale of stock does not show up in history

I've been having a lot of trouble with sell.php. I can sell stocks, that is, they are removed from the stock list but I do not receive the cash from the sale. Also, sale history does not show up on my ...
Kim's user avatar
  • 137
0 votes
1 answer
213 views

Where is the issue with my sell template?

I am having issues with the creation of a template which is supposed to show a dropdown where a user can select from a list of symbols of the stocks which he/she wants to sell. I am employing the ...
segmentationfaulter's user avatar
0 votes
1 answer
241 views

How to Access Values That Are Submitted from sell_form.php to sell.php?

I was wondering how do I retrieve the value (shares * price) of the stock sold in sell.php in order to update cash in users. In the template sell_form.php, I have the following code <select name="...
hunter's user avatar
  • 31
0 votes
1 answer
497 views

PSET 9 Finance checking that "56.00" is in page

I've been trying to solve this issue for hours and every time I run the code I get the error: ****:( sell handles valid sale Cause expected to find "56.00" in page, but it wasn't found Log ...
Kaii's user avatar
  • 1
0 votes
1 answer
89 views

FINANCE SELL : DROPDOWN MENU not showing any option DESPITE having look for solutions

This is my first time posting on reddit asking for help : I've been so far going through cs50 on ressources online when I got stuck, but here I can't figure it out even tho with the numerous online ...
Etex's user avatar
  • 1
0 votes
1 answer
180 views

Cs50 Finance :(sell handle valid sales :values appearing in index table but check50 doesnt recognise it

updated the code to display history properly,ie when sold shows negative,and when bought shows positive updated index to remove entire row when stocks is 0 I cant figure out why check 50 is not ...
Raees's user avatar
  • 1
0 votes
1 answer
57 views

Buy/Sell on Index - button attributes & form value issues

I've got a couple issues adding my own buy/sell buttons to the index page. First, each "Buy" or "Sell" buttons opens up the form for all of the table rows. How can I modify these ...
zawave's user avatar
  • 1
0 votes
0 answers
271 views

Is there a bug in check50 cs50/problems/2021/x/finance?

I completed problem set 9 and works as supposed, but with check50 I get the following result: :( sell handles valid sale expected to find "56.00" in page, but it wasn't found For testing ...
SeGue's user avatar
  • 1
0 votes
1 answer
567 views

Finance PROBLEM with lookup: TypeError: quote_from_bytes() expected bytes

I have Finance barely ready but like most codes, it has a buggy near the finish line. I have a problem with lookup. Always return None. I check it. and Terminal shows this error: TypeError: ...
santiago correa's user avatar
0 votes
0 answers
233 views

Pset8 Finance - Sell - Fails to update user's cash in "users" table, and fails to insert sold shares into "portfolio" table

Big picture: On the sell page of the CS50 Finance, I select the shares symbol I want to sell, and enter the number of shares, and click the Sell button, which redirects me to the homepage, but the ...
John's user avatar
  • 7
0 votes
1 answer
384 views

sell.html Dropdown Menu Problem

So, as the title says I can't figure out what I'm doing wrong to give the user a drop-down menu which contains the symbols of his/her stocks. Thank you for your time in advance! My intention is: -...
Dement0's user avatar
  • 13
0 votes
1 answer
2k views

CS50 finance: Sell function.(Dropdown list of user shares NOT displayed via sell.html)

Purpose of Sell: to make sure the shares bought can be sold by selecting it through a dropdown list displaying symbols of share bought. I am trying to replicate the cs50 finance default page. I have ...
Aakash's user avatar
  • 23
0 votes
1 answer
511 views

Pset7 Finance, Sell problem with POST requests

My problem is that I'm not getting any value back from my select form. I pass a list of stocks to the jinja template via return render_template("sell.html", stocks=stocks) and on the sell.html page I ...
MVierma's user avatar
  • 15
0 votes
1 answer
94 views

Buy and Sell Function not working correctly

Okay I have been working for very long on pset7 but my buy function seemed to be working correctly however when I try to buy the same stock a second time it doesn't get updated in the portfolio table ...
aash123's user avatar
0 votes
0 answers
346 views

pset7 buy/sell shares via index

As last task to do for pset7, "personal touch", I'd like to empower the user to buy and sell shares via index without having to type the stock symbol. From here I found interesting to create a form ...
Davide 's user avatar
0 votes
1 answer
409 views

PSET7/C$50Finance/buy

I have created two tables in my database named : portfolio and user_data. portfolio has fields as: user_id, Symbol, Name, Shares, Price, Total, Datetime all of them "NOT UNIQUE" so as to let the user ...
sk.76's user avatar
  • 312
0 votes
1 answer
441 views

PSET7/C$50Finance/sell

My portfolio table has fields user_id,Name,Symbol,Shares,Price,Total,Datetime showing who bought what at what price & when aka a record of all users buying their stocks. Now, if there is a user ...
sk.76's user avatar
  • 312
0 votes
1 answer
59 views

Rum time error with SQL statement in sell() when try to get total of shares from finance.db

Here is the error SQL statement: RuntimeError: (sqlite3.OperationalError) near ",": syntax error [SQL: "SELECT stock, SUM(shares) AS shares FROM 'transaction' WHERE userid = 3, stock = 'FB'"] I'm ...
Michael Zhang's user avatar
0 votes
1 answer
326 views

Pset7 sell - list out of range

So I am having trouble implementing the if function to test whether the number of shares the user is requesting to sell is less than the number of shares they have for that stock. Here's what I have ...
Ethan Teo's user avatar
0 votes
1 answer
526 views

Jinja2 + Python error "TypeError: non-empty format string passed to object.__format__"

I tried to implement sell, but there's a problem in the index template that came up when the website tried to redirect from sell.html to index.html after the sail of stocks was done. For reference, ...
Osman Zakir's user avatar
0 votes
0 answers
90 views

Undefined index problem in Pset7 Sell

I have a problem as in here: pset7 sell controller issue: undefined index. I made a new thread because that one's a year old. I hope this one won't get marked as a duplicate and get closed for it. ...
Osman Zakir's user avatar