Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: MySQLi Extended Class
06-13-2013, 03:21 AM #1
- Join Date
- Nov 2012
- United Kingdom
- Thanked 1 Time in 1 Post
MySQLi Extended Class
Currently building a MySQLi Extended Class in PHP.
- Prepared Statements
-- Insert - Complete
-- Select - Not started, trying to work how to do it.
-- Update - Complete
-- Delete - Complete
- This would be appreciated.
06-13-2013, 10:14 AM #2
- Join Date
- Feb 2011
- Your Monitor
- Thanked 506 Times in 493 Posts
My feedback would be don't bother!
I used to think these functions / classes were a great idea but then when you start using joins and other complex queries you simly won't be able to write a function simple enough to handle it all.
Same for deletes that use joined tables. You can have all the parameters in the world in your function call but then whats the point trying to remember all those parameters (slowing you down) when you could just write the SQL instead? - look at what I mean:
function select($table, $Columns, $Where, $Excludes, $Order, $Limit);
Thats just for a simple select. Now why would I want to waste 30-40 seconds of my life remembering what those parameters are, creating arrays for the $Where and $Excludes parameters when I could just write the SQL far quicker?
The only thing I will say is that using classes is ideal for multiple DB support. EG if your code / product is going to support MSSQL, Mysql and others then it's ideal as you can just switch between classes, call functions with the same name / parameter list and be done with it. If you're only supporting one database though it just isn't worth the hassle IMO.
My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!