halfer / php-tutorial-text

The chapter text for the "I ♥ PHP" project
14 stars 1 forks source link

Undefined array key "count" in C:\xampp\htdocs\blog\install.php #31

Open sozzifer opened 2 years ago

sozzifer commented 2 years ago

Thanks for the tutorial - I've completed up to the end of section 3 (Adding more features). When I amend the install.php file at the start of section 4, I get warnings about "Undefined array key "count"" and "Undefined array key "error"" on lines 94 and 95, and when I then try to view index .php I get "Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1 no such table: post in C:\xampp\htdocs\blog\index.php:7 Stack trace: #0 C:\xampp\htdocs\blog\index.php(7): PDO->query('SELECT\r\n ...') #1 {main} thrown in C:\xampp\htdocs\blog\index.php on line 7"

Any advice much appreciated.

halfer commented 2 years ago

Sorry for the delay - I haven't signed into GH for a long time. Reddit is probably the best place to catch my attention (see the footer in the tutorial page).

There's a couple of issues here. It looks like the installer file has an issue in your code - if this does not produce the right tables then yes, the rest of the code won't function.

Check your code against these files:

Admittedly these are the final state of the installers rather than what they look like at the end of section 3, but looking at them may help.

Alternatively post your versions of these files in the Reddit sub and ping me there, and I will see if I can assist.