All Questions
10 questions
0
votes
1
answer
332
views
Pset7 (Movies) 12.sql: Table outputs 96 rows rather than 5 rows
I've been stuck on this for quite some time and did a lot of research on the AND operator in SQL, but no matter how many variations I try I cannot get my table to output just 6 rows, with each row ...
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 ...
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 ...
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 ...
0
votes
1
answer
360
views
How to make search.php return results that are more relevant
For pset8 in search.php, I cannot get relevant results to show up. I am using match () against () and I really want to only use this. The problem is, for example, when I type in Cincinnati, I get ...
0
votes
1
answer
48
views
Printing from SQL in PHP
I am trying to print text I have placed into a MySql database. I have been able to insert into the database, but I don't know what to put to take out the value/text
<?php
require("../includes/...
0
votes
1
answer
292
views
What is wrong with this SQL command?
query("INSERT INTO stocks (id, symbol, shares) VALUES($_SESSION["id"], $_POST["symbol"], $_POST["number"]) ON DUPLICATE KEY UPDATE shares = shares + VALUES(shares)");
I am getting this error
Parse ...
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['...
0
votes
1
answer
75
views
SQL Order results by score, desc
What SQL query do I have to run to get all of the rows from a table, ordered from highest score to lowest score? I tried a few different queries, none worked.
Thanks,
David
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 = ...