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
...
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.
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 ...
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 ...
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 ...
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.
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, ...
Only top scored, non community-wiki answers of a minimum length are eligible