I am new and I have this book I am reading. One of the examples is to connect to a database and retrieve results. There are three pages.
Page 1
[php]
[/php]
Then there is the index file which is just a page to start things so it just include the above file. Then there are two other pages one to display errors:
[php]
<?php echo $error; ?>
[/php]and one to display the results
[php]
<?php foreach ($jokes as $joke) { echo htmlspecialchars($joke, ENT_QUOTES, 'UTF-8'); } ?> [/php]
I get a variable undefined error although it should work in my opinion. I want to know why is the variable $jokes which is actually an array undefined in this context?