2
votes
Accepted
pset6 How to tackle check50 on .php?name=Alice
The strtok() call here:
char* absolute_path = strtok(req_tar, "?");
will crop req_tar at the ? and make it always be equal to abs_path.
Because of this, the following condition will never be true ...
2
votes
Accepted
Pset7: Undefined offset in register.php
Look carefully at this line: $_SESSION[$id];. Remember it is $_SESSION["id"] that controls whether a user is logged in or not.
This if ($result === false) is also a problem. Since the select query ...
1
vote
Accepted
Difference between CS50::query() and query()
When you are using CS50 IDE with inbuilt CS50 SQL library files then it's easier to use CS50::query() function.
In normal situations, eg in a linux machine, you can use only the query() function.
...
1
vote
Accepted
Check if query returns empty value
db.execute always returns an array, you can always print to the console to see its content, if your intention is to debug. If what you want is to warn the user, simply check that result is not null ...
1
vote
Accepted
CS50 Understanding Technology Progress
Patience, young grasshopper. Certificates are processed once a month, during the first week of each month. It sounds like you missed the last run. If you don't have it by Mar. 10, then contact staff.
...
1
vote
SQL SELECT query
It will return a list of dicts. Each dict item contains a key:value pair, where the key should be the same as the keys in your portfolio table (ex. symbol, stockname, price) and the value being values ...
1
vote
Accepted
PSET6 Parse Segmentation Fault
When you declare a string literal, as with char* php = "";,it is stored in read-only memory. So it is indeed seg-faulting here strcpy(php, path); because it cannot change read-only memory.
Even if ...
1
vote
Accepted
pset7 sell.php I seem to be missing something
It is right. CS50::query() always returns an array of rows, even when the result is just one row.
That's why you should use the [0], as you have correctly done.
You can ctrl+F this:
// first (...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
query × 36pset7 × 13
pset6 × 9
pset8 × 6
server × 4
sell × 4
mysql × 4
sql × 3
mashup × 3
parse × 3
php × 3
finance × 2
segmentation-fault × 2
html × 2
search × 2
import × 2
cs50x × 1
check50 × 1
cs50-ide × 1
flask × 1
buy × 1
cs50-web-programming-with-python × 1
pset × 1
index × 1
register × 1