Skip to main content
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 ...
Yuri Laguardia's user avatar
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 ...
DinoCoderSaurus's user avatar
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. ...
Akshay Sreekumar's user avatar
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 ...
MARS's user avatar
  • 5,179
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. ...
Cliff B's user avatar
  • 69.3k
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 ...
tishihar's user avatar
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 ...
DinoCoderSaurus's user avatar
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 (...
Yuri Laguardia's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible