Skip to main content

Questions tagged [sql]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
145 views

SQL Query returning nothing

For my final project, I query my database for a the ID of a city whose Name I already have. However, SQL returns no such city even when there is one. Code (Line with error is surrounded by stars): ...
AK2150's user avatar
  • 11
0 votes
1 answer
200 views

Finance: Can not Update and Insert to SQL

In my buy function I cant INSERT or UPDATE data in SQL. RuntimeError: (sqlite3.OperationalError) near "ON": syntax error [SQL: INSERT INTO buy (share_name, share_symbol, share_price, shares, id) ...
Tory's user avatar
  • 1
0 votes
1 answer
98 views

Can a select return nothing without causing an error? How do I create a if condition that returns True if the database is empty?

I posted my code in another post I have made a lot of revisions. Kind of irrelevant but just thought I should mention it if someone goes through my last post. I have a select statement. Lets say my ...
grggthwrth's user avatar
0 votes
0 answers
205 views

PSET8 finance index giving internal server error, can't find a table that already exists

Whenever I go to the web server, and I log in, I get an internal server error. It says " no such table: transactions [SQL: 'SELECT stock, SUM(shares) as sumshares FROM transactions WHERE user_id = 1 ...
Joel Banks's user avatar
0 votes
1 answer
623 views

SQL SELECT query for multiple word search

I'm working through project 1 in the CS50 Web Programming course. I have created a search form which is just one text box in the middle of the page where the user can type in the ISBN number, the ...
fejkens's user avatar
0 votes
1 answer
118 views

Final Project: Using data in SQL to modify HTML of web page?

I am not sure if this is the right place to ask for help with my final project or if I should use a more general programming forum, but hopefully you guys can help me out. How do you modify the HTML ...
David Zangardi's user avatar
0 votes
2 answers
69 views

On duplicate key update doesn't work correctly

I'm trying to figure out how to, On a duplicate key, add the amount of shares from the form, to the existing amount of shares. This is proving to be very tricky for me, I described a variable called ...
Joel Banks's user avatar
0 votes
1 answer
75 views

Specify Multiple Search Conditions for SQL

this is a question about search() in pset8 Mashup. How does one select rows given multiple characteristics(for example in pseudo code, SELECT * THAT CONTAIN KEYWORDS "New Haven" AND "Connecticut" AND ...
faelesterio's user avatar
0 votes
1 answer
99 views

pset7: one "history" table for each user?

In pset7 Finance, for the "History" table, this table will sum up the transactions for EVERYBODY who registered, right ? I understand I can later use SELECT(JOIN) but is there another way to make a ...
Malintzin's user avatar
0 votes
1 answer
122 views

cs50 pset7 finance always get an error in valid buy execution;;;;;

@app.route("/") @login_required def index(): """Show portfolio of stocks""" cash = db.execute('SELECT cash FROM users where id=:id',id=session["user_id"]) cash = cash[0]["cash"] stocks ...
dbdbdbdb's user avatar
0 votes
1 answer
674 views

It is not displaying data the query order from Flask SQLAlchemy

I was trying to display data tables from my db on same page like from one table only one row from another table all the rows and is displaying the data from first table but from second table is not is ...
alex's user avatar
  • 5
0 votes
1 answer
592 views

PSET7 - Register returns 'RuntimeError: no such table...'

I've implemented everything and register worked fine at first but now I'm getting stuck with a RuntimeError: no such table: Porfolio [SQL: 'SELECT * FROM Porfolio WHERE id = 1']. Any help in how to ...
Anna's user avatar
  • 7
0 votes
1 answer
174 views

pset7 finance register sql

I've been working on the register part of the finance problem and I think I have most of it but I really don't understand how to do the SQL parts of it. I need to learn how to store the username and ...
Joel Banks's user avatar
0 votes
1 answer
216 views

pset7 - How to remove the primary key in my table

In pset 7 CS50 Finance I have a problem where new rows are not being added to my data tables Portfolio and History, and I think the reason is that I set the id column to be the Primary Key. So, now I ...
L.D's user avatar
  • 27
0 votes
1 answer
82 views

Deducing shares from SQL rows until all sold shares are exhausted PSET7 FINANCE

The way I implemented my table, I registered all transactions to facilitate index and history. In index, I show only my positive stocks and they can be repeated if bought more than once (We also have ...
B Furtado's user avatar
  • 111
0 votes
0 answers
23 views

CS50's PHPLIteAdmin [duplicate]

I am currently working on my final project, and I need to create a database which contains a table with a FOREIGN KEY field. Unfortunately, I've constantly been getting errors. Upon Googling them, I ...
mathmagician's user avatar
0 votes
0 answers
107 views

Pset8 no such column: postal_code

I am trying to perform simple search in mashup.db database db.execute( "SELECT * FROM places WHERE postal_code = :q",q=request.args.get("q")) However I am getting RuntimeError: (sqlite3....
Austris's user avatar
0 votes
1 answer
60 views

Pst7 combine SQL similar rows

Right now I have made two tables to store user data and all transactions what users made. Structure of transaction table looks like this: id user symbol price quantity ...
Austris's user avatar
0 votes
1 answer
1k views

SQL Query showing as undefined

I have a database and I want to count the number of times a state shows up in it. I wanted to use this number later for calculations. However, when I try to do something like this (which correctly ...
K. Rich's user avatar
  • 11
0 votes
1 answer
170 views

Pset7 buy function SQL

I am struggling with writing data to database when user buys stocks. After code execution no new insertions appears in database and no error messages appears. Also how to get current user name to link ...
Austris's user avatar
0 votes
1 answer
683 views

CS50 Finance - How to add to cash

I want to make it so the user can essentially add $10,000 to their current balance. To do this, I made a user with id 26 that has $10,000. I want to add user26's funds to the current user's funds to ...
K. Rich's user avatar
  • 11
0 votes
1 answer
328 views

pset7 finance app in Python - buy function won't add anything to database!

The code I've written for the parameter checks all works fine, and on clicking the buy button everything seems to work... but then nothing gets added to my database! I've combed through the SQL query ...
StephanieJosine's user avatar
0 votes
0 answers
166 views

How to check if an SQL table exists without relying on errors?

pset7 help pls. Trying to check if a table exists. I am getting the error "information_schema.tables does not exist". I guess information_schema is not there in our SQL version? How else could I ...
Sank Finatra's user avatar
0 votes
2 answers
114 views

PSET7 SQL Query Not Working in buy.php

This is my code for buy.php. I think the issue is with my SQL line, which is "INSERT INTO Stocks (user_id, symbol, shares) VALUES(?, ?, ?) ON DUPLICATE KEY UPDATE shares = ?", $_SESSION["id"], ...
DSmith's user avatar
  • 45
0 votes
1 answer
252 views

register.php pset7

I do not understand why the following code do not work as it should. $result= query("SELECT * FROM users WHERE username = ?", $_POST["username"]); if($result === true) { apologize("Username ...
James C's user avatar
0 votes
1 answer
135 views

Final Project: Trying to access phpmyadmin through CS50 ID (similar to Pset7) but find "This Webpage is Not Available"

I am trying to use SQL in more or less the exact same way as we did in pset7, but whenever I try and access phpmyadmin it tells me the web page is not available. I already checked my chmods, apache, ...
S. Dunn's user avatar
0 votes
1 answer
42 views

LIKE vs equal sign - basic question

I know I can use wildcards such as % with sql's LIKE. Besides this, are there any advantages of LIKE over a simple equal sign? So, has this: SELECT * FROM places WHERE MATCH (postal_code, place_name,...
Lex's user avatar
  • 55
0 votes
1 answer
923 views

Pset8 search.php (still) not working

I can't get sql's "match against" to work. I thought I understood how to do this, except when I actually used sql's match (...) against (...) syntax, I got an error. This error doesn't say anything, ...
David's user avatar
  • 107
0 votes
2 answers
189 views

pset7: query problem

When I try these with query function it is giving me an error: query("SELECT * FROM users WHERE username LIKE %?%", $_POST['username']); query("SELECT * FROM users WHERE username LIKE '%?%'", $_POST['...
Hussain Noor Mohamed's user avatar
0 votes
1 answer
211 views

pset7 unknown column in where clause

This throws an error saying YHOO is an unknown column...I thought 'symbol' was the column name in this query? $id = 6; $symbol = "YHOO"; $shares_query = query("SELECT shares FROM portfolio WHERE id = ...
SeanIvins's user avatar
0 votes
2 answers
75 views

Pset7, is it using a different php version in 2017? Why do I see "$" when searching for help

Are we using a different version of Flask, SQLite or PHPliteadmin in 2017? Why are the codes i'm seeing in the web so different from mine..? Mainly, the $ sign, I've never used a single $.. Unless I'...
nvs0000's user avatar
  • 179

1 2
3