Search code examples
phppdophpmyadminmysql-error-1054csv-import

CSV Import phpMyadmin error #1054 missing column even though it is there


Thank you whoever is reading this. I have tried looking for similar answers / solutions for last couple hours. All answers begin when people were importing data manually, I import it into my table using CSV file.

This is how my csv file looks. CSV File

after the import, and adding ID field an assigning it a primary value with AI, it looks like this: table structure

I can easily access the Fault and ID tabs on my php file, accessing them via fetchAll(PDO::FETCH_ASSOC); code.

However, if I add Link to my SELECT statement, I get an error message saying field does not exist.

Also noticed that trying to check the full text value gives me this error message: enter image description here

But if I try to change the view option to full text and doubleclick the cell again, I get no error message: enter image description here

Considering all this, I am rather confused how come it cannot find the Link field in the database, even thought it finds ID and Fault cells absolutelly fine from the same table.

Any suggestions will be greatly appreciated, thank you.


Solution

  • Solution: Not really anything to do with PHPMyAdmin apart from the fact that when I've imported a CSV file, it has a Space next o Link.

    With the help of user chris85 I've changed my loop to just an array and printed all of it. Spent good 10 minutes looking through it as it did not give me any error messages yet had the "Link" field. Turns out, when I've printed the results / saved them in the CSV file, I have accidentally added a Space ( ) before Link.

    This was a major headache, but thank you for helping me figure this out @chris85 I've then altered my echo "<td>" . $forumDetail['Link'] . "</td>";

    to have a space, like this :

     echo "<td>" . $forumDetail[' Link'] . "</td>";
    

    And that printed the result absolutelly fine.

    Once again, stackoverflow proves the importance of one empty space or a missed semicolon :)