Skip to main content
3 votes

How to link submit button with the <select> list in HTML?

You can achieve that using JavaScript: <div> <h1>SELECT A TOPIC</h1> <select id="select"> <option value="physics">physics</option> <option value="...
Michał Perłakowski's user avatar
3 votes

phpMyAdmin: "mysql extension missing" error

We all know that phpMyAdmin can be flaky sometimes. Unfortunately, I can't tell you how to fix it -- but I can tell you how to use mysql50 shell from the command line. Try stuff like this: mysql50 ...
hotwebmatter's user avatar
  • 3,050
2 votes

include 'file.php' does not seem to work

You've probably gotten used to using #include statements in C. The equivalent function in PHP is require(). If you have access to pset7 or pset8, just look at the distribution code provided. You'll ...
hotwebmatter's user avatar
  • 3,050
2 votes
Accepted

syntax error, unexpected 'for' T_FOR

Not all of them! $alphacount = 0 :)
DinoCoderSaurus's user avatar
2 votes

cs50::init(_DIR_."/../config.json") pset7

To answer the specific question from your comment "why is :: used?" From the config section of the spec (That :: syntax just means that init is "inside of" an "object" called CS50. An object in ...
DinoCoderSaurus's user avatar
1 vote

PHP removal from CS50

Disclaimer: I am not part of CS50 team, and don't know their reasoning. This is my opinion, why I think that has been a good idea, especially when touching currently trendy topics like "machine ...
Blauelf's user avatar
  • 21k
1 vote
Accepted

PSET7: Extracting strings from queries with PHP

You have answered yourself: Is it because the rows themselves are associative arrays, and so I can never actually extract a single value? If that's the case, how would I just pass one variable ...
Yuri Laguardia's user avatar
1 vote
Accepted

How can I update the version of php on my cs50 appliance?

You don't need to update it to complete your problem sets. update50 will take care of the necessary updates. If you are done with your problem set. you can download apache, mysql, php7, phpmyadmin to ...
A.Emad's user avatar
  • 176
1 vote

illegal string offset error in portfolio

Each time you do this $positions[] = ["price" =>number_format($positions["price"],2,'.',',')]; there is a row added to the $positions array that does not have "name", "shares" or "symbol". Ditto ...
DinoCoderSaurus's user avatar
1 vote
Accepted

Pset7 - Portfolio: $positions not filling

Oh. My. Goodness. My 2nd test condition wasn't a valid stock (just some random capital letters that I thought looked like an actual stock symbol) so if ($stock !== false) would kill the foreach() ...
Casey Belcher's user avatar
1 vote
Accepted

Do calls to render() overwrite each other?

When you call render() in a controller, the function is only executed once and then it exits. No other code in the PHP Controller will execute after the call to render(), so it is not possible for ...
hotwebmatter's user avatar
  • 3,050
1 vote

redirect my apache index?

I went with a change in /etc/apache2/sites-available Works good thanks! Here is some shortcuts for future reference. pi@raspberrypi2 /etc/apache2/sites-available $ apache2 default Usage: apache2 [-...
Jake's user avatar
  • 96
1 vote
Accepted

redirect my apache index?

NEW ADVICE: This tutorial should help you to change the DocumentRoot of your website by using Apache2 Virtual Hosts. The focus of the tutorial is on how to host more than one domain or subdomain on ...
hotwebmatter's user avatar
  • 3,050
1 vote
Accepted

What's is wrong with this php code

echo("</tr>") not properly terminated.
DinoCoderSaurus's user avatar
1 vote
Accepted

Encrypted passwords in POST method

Q: When should I encrypt passwords? A: Always, and as soon as possible. Whenever a user enters sensitive information like a password, you should immediately encrypt it using a one-way hash function ...
hotwebmatter's user avatar
  • 3,050
1 vote
Accepted

C$50 Finance Pset7 - Buy.php not INSERTing shares correctly

Learn something new every day! From the manual: With ON DUPLICATE KEY UPDATE, the affected-rows value per row is 1 if the row is inserted as a new row, 2 if an existing row is updated, and 0 if an ...
DinoCoderSaurus's user avatar
1 vote
Accepted

How difficult are pset7 and pset8?

PHP is much easier than C in many ways. You definitely won't need to worry about pointers and malloc() and free() any more! You will be doing some file I/O, but nothing involving low-level file stream ...
hotwebmatter's user avatar
  • 3,050
1 vote

pset7 reset password php mail function doesn't send email

OK, I want you to try exactly what I did: Execute the following to make sure you have git installed, and wait for the command to finish sudo apt-get install git Execute the following to get the ...
ChrisG's user avatar
  • 7,396
1 vote
Accepted

PSET8: fopen() not working for import

You added an extra unwanted ; on this line: if ($handle == FALSE); Remove the semicolon and it will work as wanted.
ChrisG's user avatar
  • 7,396
1 vote

Drop-down Menu for Sell_View.PHP gives empty options

How are you passing the php variable from your controller to your viewing page (sell page)? You are storing the array returned by your mysql query in $symbol, but it looks like you are passing $stocks ...
ronga's user avatar
  • 1,415
1 vote
Accepted

How to make search.php return results that are more relevant

It's as simple as turning this and obviously I would prefer "Cincinnati, OH" to be the first result. into computer code :) Kinda moves into the realm of computer learning/intelligence. First ...
DinoCoderSaurus's user avatar
1 vote

How should I connect to the multiple databases?

Admittedly I don't fully grasp what you mean "merge several psets". However,in the narrow and specific context of CS50 pset7 & pset8, you do not need two databases. Consider adding the places ...
DinoCoderSaurus's user avatar
1 vote
Accepted

week7 lecture2 source code speller.php not found

From your first link choose Index in the Source Code pane (far right). Choose misspellings/. Click on download to the right of speller. It will open with a text editor (like notepad++). It's also in ...
DinoCoderSaurus's user avatar
1 vote
Accepted

pset6: PHP Templating and Indexes

about your /test problem, you forgot to check if the path already has a '/' at the end, and add it if it's not the case.
user3781458's user avatar
1 vote
Accepted

Debugging in Problem Set 7: CS50 Finance

I forgot to answer my own question. Using dump() is better than using print statements
David's user avatar
  • 121

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