So what about an oop approach?! For example you could use a class to encapsulate database access? That would prevent doing mysql_real_escape_string() everywhere! Maybe PDO is worth a glance ;) .
And: DRY! Dont repeat yourself.
et cetera pp
Luke
· 1 year ago
Switching to an OOP system is a pretty good idea - when I first started writing this tutorial code, I didn't realize that I'd be repeating myself quite this much.
I'll have to work on designing an OOP version of our database access code - unfortunately, I won't be able to use PDO as I'm aiming at keeping the PHP code given here compatible with PHP 4, which is what a lot of hosts are still using.
sepp
· 1 year ago
By the way: Don't take PHP4 as your base. It's obsolete and will be vanished in the near future. Version 5 gives much more powerful tools, especially for object orientated programming. Give it a try ;) . "A lot of hosts" doesn't have to be "the most" ;) .
Luke
· 1 year ago
Oh, you're right - it looks like PHP 4's end of life has come and gone. I only thought that it had been announced - not that it had happened.
And: DRY! Dont repeat yourself.
et cetera pp
I'll have to work on designing an OOP version of our database access code - unfortunately, I won't be able to use PDO as I'm aiming at keeping the PHP code given here compatible with PHP 4, which is what a lot of hosts are still using.
Whoops! Thanks for pointing that out, sepp.