All Questions
4 questions
0
votes
1
answer
28
views
pset7: why do we need [0] in from of list? (e.g. someData[0]['dic']?)
Just completed pset7, gosh it was a long one, took a month!
Am curious as to why we need to have a [0] in front of the list to get the "pure" data?
For instance, when we get back a list while ...
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 ...
2
votes
1
answer
181
views
PHP array syntax
I am confused about why I can't print the content of $positions using the code below.
$rows = query("SELECT * FROM protfolio WHERE id = ?", $_SESSION["id"]);
$positions = [];
foreach ($rows as $row)
...
1
vote
1
answer
360
views
pset7: understanding php arrays
I'm having a lot of trouble understanding these arrays in php. Here I want to query SQL to get me the value of cash of the user. Then I want to add it to the $position variable that is later sent to ...