0

I am working on Pset8 (AKA mashup) and have run into an issue with my import script.

It turns out that I have an issue with the SQL query that I am doing to insert each line from my US.txt file. It seems to be importing but when I go to PHPMyAdmin there is nothing in my places. table.

I was wondering if anyone would be able to give me some pointers as to what I might be doing wrong.

I know that the last three columns should hold numeric values. Otherwise, I know that the other fields are varchars (i.e. strings).

Here's the pastebin to my code: http://pastebin.com/KARrwCBK

edit: I have got that part sorted. However, I think for some odd reason my fgetcsv call is giving me an empty array. as such when I go to PHPMyAdmin it shows an empty MySQL table! Here's the updated pastebin: http://pastebin.com/zNfj8Ycj

Kind regards, Adi (a CS50x student from London, UK)

  • All the code in the while loop is commented, so insert is never done. – DinoCoderSaurus Nov 17 '16 at 12:47
1

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 indeed see all the lines from my data set (in this case US.txt). I am advancing now onto the third out of four to-dos (search.php)

| improve this answer | |
  • 1
    After a few days, please come back here and accept your own answer to this topic, so the question can be closed and rest in peace! – Yuri Laguardia Nov 17 '16 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .