There's not but just put a last_updated column on the table you're pulling data from then "SELECT * FROM XXXX WHERE 1 ORDER BY last_updated LIMIT 1". Voila.
I think it's a problem with PHPers who have started with PHP as their first language and built up from there without the background and strict requirements of another OO language.
This is the right way to do it. What you're doing will work but it's not best practice and anyone else picking up your code will be scratching their head for a minute.
This is really good advice. Seeing things from a different perspective is a good idea. Also take a look into improving the quality of your work and ensuring quality standards with unit testing/TDD and other PHPUnit tools. Do some investigation into continuous integration servers (Jenkins is IMO the best). jenkins-php.org.
Also I hate to put it this way but getting into a "real" programming language like Python would be a good move and make you look at PHP differently.
It breeds innovation when people are trying to do things differently. The thing is, most of these frameworks are very similar and rarely do anything innovative.
You're right the view should just be dispalying content to the use.
The controller should handle the business logic of the application. So in there you'll have a method for each route and make the calls to the relevant models and methods.
The models are just PHP classes and contain the application logic. So form validation, database methods, user classes etc.
You could take a look at a framework (codeigniter would suit you well) and refactor your code to work in the frameworks MVC layout. Doing this would be a good way of figuring out how MVC works.
I think you're spot on here. A lot of the time someone will try and shoehorn a solution into an existing CMS when a better solution would be a bespoke application.
PHP's mail function will let you send emails. You can send HTML emails with it but it's quite tricky. There's some pointers on PHP.net's mail function page.
If you're happy with using objects in PHP PHPMailer is really good and makes sending HTML emails a lot easier.
I've tried using Zend Studio four or five times now and it always just seems laggy and unresponsive even with a bunch of tweaks I've always given up on it.
I'm back on Netbeans again. It's free, quick and supports most of what Zend studio does.
I've never understood the less lines is good thing. To me, if it doesn't affect performance then readability and maintainability is infinitely more important.
There aren't in PHP but MySQL has enums as a data type.
It's a lot nicer than using an integer which means nothing when you come back to it.
Use enums!
Join a company an learn how businesses work. Programming is one thing, project and client management will help you a lot in the future.
There's not but just put a last_updated column on the table you're pulling data from then "SELECT * FROM XXXX WHERE 1 ORDER BY last_updated LIMIT 1". Voila.
I think it's a problem with PHPers who have started with PHP as their first language and built up from there without the background and strict requirements of another OO language.
Aye, your way is better IMO.
This is the right way to do it. What you're doing will work but it's not best practice and anyone else picking up your code will be scratching their head for a minute.
Just make the authorisation properties private.
This is really good advice. Seeing things from a different perspective is a good idea. Also take a look into improving the quality of your work and ensuring quality standards with unit testing/TDD and other PHPUnit tools. Do some investigation into continuous integration servers (Jenkins is IMO the best). jenkins-php.org.
Also I hate to put it this way but getting into a "real" programming language like Python would be a good move and make you look at PHP differently.
Take a look at Google graphs. It's really good.
I refer you to this http://www.joelonsoftware.com/articles/fog0000000069.html
It breeds innovation when people are trying to do things differently. The thing is, most of these frameworks are very similar and rarely do anything innovative.
I know rolling your own framework is a good way to learn to programme but PHP doesn't need more frameworks. Really. Just stop.
The class naming is mental though. Capital first letter then underscores?!
You're right the view should just be dispalying content to the use.
The controller should handle the business logic of the application. So in there you'll have a method for each route and make the calls to the relevant models and methods.
The models are just PHP classes and contain the application logic. So form validation, database methods, user classes etc.
You could take a look at a framework (codeigniter would suit you well) and refactor your code to work in the frameworks MVC layout. Doing this would be a good way of figuring out how MVC works.
I think you're spot on here. A lot of the time someone will try and shoehorn a solution into an existing CMS when a better solution would be a bespoke application.
PHP's mail function will let you send emails. You can send HTML emails with it but it's quite tricky. There's some pointers on PHP.net's mail function page.
If you're happy with using objects in PHP PHPMailer is really good and makes sending HTML emails a lot easier.
-1 for ambiguity
Things like this stop your code being readable. Please be careful where you use these and comment your code.
Cool. Glad I could help :)
You should really be using PDO SQL prepared statements for queries nowadays which will look after the prevention of injection attacks for you.
http://php.net/manual/en/pdo.prepared-statements.php
Joomla?
I've tried using Zend Studio four or five times now and it always just seems laggy and unresponsive even with a bunch of tweaks I've always given up on it.
I'm back on Netbeans again. It's free, quick and supports most of what Zend studio does.
I gave you five stars. I also created an incredibly useful function.
http://projects.westhost.com/contest/php/function/isitmonday/147#php-snippet
This is wrong isn't it?
People still use functions??
I've never understood the less lines is good thing. To me, if it doesn't affect performance then readability and maintainability is infinitely more important.