Unknown Column in Field List. PHP + Mysql

后端 未结 2 880
广开言路
广开言路 2021-02-09 16:22

I\'m trying to add values to a table in phpmyadmin and I get the error: Unknown column \'...\' in \'field list\'.

Here\'s my code:

    

        
相关标签:
2条回答
  • 2021-02-09 16:41

    I think this

    $query = "INSERT INTO tblGames (name, description, image) VALUES ($name, $description,". $target_path .")";
    

    should be

    $query = "INSERT INTO tblGames (name, description, image) VALUES ('$name', '$description', '". $target_path ."')";
    
    0 讨论(0)
  • 2021-02-09 16:55

    It looks like the values should be quoted in your $query statement, i.e. $name, $description, and $target_path.

    $query = "INSERT INTO tblGames (name, description, image) 
              VALUES ('$name', '$description', '" . $target_path . "')";
    
    0 讨论(0)
提交回复
热议问题