It tells you what you have done wrong. you are trying to insert data into column '0' and '1' which I bet you don't have in your table. Check your insert statement (Board::create()) cause it seems that you have mixed the keys and the values. My guess is that you have a column named title and one named description.
Jul 18, 2020
2
Level 7
Issue with SQL while running test (Build a Laravel App with TDD course)
Hi,
Yesterday i started this course and ran into problem immediately after 2nd lesson.
I tried to copy everything from that lesson but it won't work. I have "SQLState Unknown column" issue and i was not able to find proper solution online.
This is the error when i try to run the test.
SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'field list' (SQL: insert into `boards` (`0`, `1`, `updated_at`, `created_at`) values (title, description, 2020-07-18 17:52:32, 2020-07-18 17:52:32))
at D:\laragon\www\lv-birdboard\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {
> 671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|
1 D:\laragon\www\lv-birdboard\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458
PDOException::("SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'field list'")
2 D:\laragon\www\lv-birdboard\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458
PDO::prepare("insert into `boards` (`0`, `1`, `updated_at`, `created_at`) values (?, ?, ?, ?)")
In mysql table, i can see created_at and updated_at columns but it looks like sqlite issue.
Any help please.
Level 74
1 like
Please or to participate in this conversation.