Skip to main content
4 votes
Accepted

Why can't I use get_int in python

In python, if you want to use a function from an imported library, you have to somehow tell Python that you are going to get that function from which library. I would do: h= cs50.get_int() or ...
Ha Tran's user avatar
  • 74
2 votes
Accepted

pset8, import. Only even row numbers from US.txt are being written to db

This while(fgetcsv($file, 500, "\t")) is reading the odd numbered lines. This $csvarray = fgetcsv($file, 500, "\t"); is reading the even numbered lines, which are then inserted into the db.
DinoCoderSaurus's user avatar
1 vote

Why can't I use get_int in python

For the sake of completeness, you could also do: from cs50 import get_int h = get_int("Height: ") But directly importing functions (or classes, etc) from a module is not recommended. It'll ...
MestreLion's user avatar
1 vote
Accepted

Pset8, Mashup, import, i have been seen this error

You're probably doing this: require("/..includes/config.php"); When you should be doing this: require("../includes/config.php"); If this solves your problem, please click the check mark to accept ...
Yuri Laguardia's user avatar
1 vote

Pset 8 Mashup Import Issue (fgetcsv returns empty array)

I figured it out! It turns out that the issue was not the commented code. The issue was actually the declaration of the while loop. I can confirm that's the case because when I go to PHPMyAdmin I can ...
AdiKhajuria's user avatar
1 vote

Pset8 - Import using PHP array

Try dump($keywords) to verify that the array data structure contains what you want it to. Also, if preg_split() is giving you trouble here, you may find it easier to use fgetcsv(). Hope this helps.
hotwebmatter's user avatar
  • 3,050
1 vote

Pset8 import undefined offset notice

Try this fgetcsv($handle, 0, "\t") instead of this fgetcsv($handle, "\t") Why? Because the second parameter of fgetcsv() is the length of the line. Thus, if you don't explicitly put it there, ...
Yuri Laguardia's user avatar
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

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