PHP coding being commented out by the HTML editor
The "Readings" page (www.sitename.org/Readings) in the site shows a daily reading which is provided by the MySQL database mentioned above. This page uses the PHP mysqli_connect function to access the database.
From what I have read in the documentation, I need to use a single-page in order to use PHP code to access a MySQL database other than the database that generates a Concrete5 page.
I tried to edit my single-page by creating a block and using the HTML editor to write the appropriate PHP code. However, when I checked on the block after using the HTML editor, it came up empty. Going back into the HTML editor, I found that my PHP code had been commented out. For example, <?php echo("Hello World!"); ?> would be changed to <!--?php echo("Hello World!"); ?-->.
How do I get Concrete5 NOT to comment out my PHP coding and hence the mysqli_connect function?
You need to hard-code your database open/read/write code into the single page itself or better yet, build it into a controller file.
To use a separate controller for a single page that resides in your '[root]/single_pages' folder, you add an identically named file in the '[root]/controllers' folder so if your single page is '[root]/single_pages/my_single_page.php', you should have a file by the same name in '[root]controllers/my_single_page.php'. This controller page is where you put the I/O functions that deal with your database.
Have a look at this CRUD package on GitHub. It might give you some ideas on how to approach this: