Greetings,
I am building a new site, HTML, PHP, MYSQL.
I am having a discussion with a coworker regarding how I should handle my PHP functions that handle my SQL.
In my HTML page I call my PHP function, which accesses my MYSQL.
Should my PHP function:
- extract the data from the MYSQL, process it and return the complete HTML code? (my preference).
- extract the data from the MYSQL, return the data to the page and let the page handle the HTML portion of it (through other PHP)? (my coworker's preference).
- or do neither and put all the PHP directly in the HTML page (no external function).
Hence should my PHP function handle just the data or take care of the presentation HTML part as well. Or should it be separated from the presentation layer?
Not sure if this is strictly a philosophical question or a technical one? Are there advantages to one or the other (speed, maintainability, ...). Or are we just arguing for the fun of it?
Thanks for any ideas,
Nic