0

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.

Norbis
  • 89
  • 2
  • 9
  • It looks like the error is in the phpmyadmin, is there PHP/PDO for this question? – chris85 Apr 09 '17 at 23:02
  • I use PDO for SQL execution and it's all on PHP, I've left it in thinking it could be something to do with it too. As it's PDO on a PHP querry that gives me the error Unknown column 'Link' in 'field list'' That's why I've included those tags. – Norbis Apr 09 '17 at 23:05
  • Do you get the same behavior with the PDO/PHP interaction? – chris85 Apr 09 '17 at 23:19
  • Sadly Yes, it gives me pretty much the same error message, that's why I was initially confused and went to check my phpmyadmin table thinking I might have named the field wrong. This is the error - "Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Link' in 'field list'' in /forumTable.php:23 Stack trace: #0 forumTable.php(23): PDOStatement->execute() #1 {main} thrown in forumTable.php on line 23" – Norbis Apr 09 '17 at 23:24
  • 1
    What about `select *` and then fetch as an associative array and print 1 full row. – chris85 Apr 09 '17 at 23:25
  • Which is basically pointing to my SELECT statement: $sql = "SELECT ID, Fault, Link FROM ForumThreads2"; Before I only chose from ID and Fault, I've now added Link and I get that error message. – Norbis Apr 09 '17 at 23:26
  • When you select all columns then output them what does it show? – chris85 Apr 09 '17 at 23:27
  • Tried printing it all in one statement, I do get this: [0] => Array ( [ID] => 1 [Fault] => Pics: AF's GT-R 1971 RHD GT-R & 2015 GT-R [ Link] => showthread.php?s=0d616f4fd6f2335a660f37bc44e1ff05&t=1139638 ) [1] => However, also tried adding the ['Link'] option to my existing results and that field just remains empty. – Norbis Apr 09 '17 at 23:36

1 Answers1

0

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 :)

Norbis
  • 89
  • 2
  • 9
  • I'd recommended updating the table so the name doesn't have the space. http://stackoverflow.com/a/4002425/4333555 – chris85 Apr 10 '17 at 00:06