OOP is definitely the way to go. The best advise I can offer is to read the book "Clean Code" by Uncle Bob. The code there is in Java but all principles apply equally to any other language.
I would definitely abstract the DB interface so I can use for any other database, even if you don't plan it in the next future. I have posted small data store architecture code small data store architecture code that may help you.
From a look at your code, I am a bit confused by the naming connect
and connection
and the latter stores $connect
in the constructor. Maybe give a more descriptive names (one of the top recommendations in the mentioned book).
Why are you unsetting
$connect
?The names such as
$LNK_ID
are cryptic for reader.I would reserve a separate class dealing with the database via thin interface (see my post) and let other classes only talk to that class instead of DB directly.
OOP is definitely the way to go. The best advise I can offer is to read the book "Clean Code" by Uncle Bob. The code there is in Java but all principles apply equally to any other language.
I would definitely abstract the DB interface so I can use for any other database, even if you don't plan it in the next future. I have posted small data store architecture code that may help you.
From a look at your code, I am a bit confused by the naming connect
and connection
and the latter stores $connect
in the constructor. Maybe give a more descriptive names (one of the top recommendations in the mentioned book).
Why are you unsetting
$connect
?The names such as
$LNK_ID
are cryptic for reader.I would reserve a separate class dealing with the database via thin interface (see my post) and let other classes only talk to that class instead of DB directly.
OOP is definitely the way to go. The best advise I can offer is to read the book "Clean Code" by Uncle Bob. The code there is in Java but all principles apply equally to any other language.
I would definitely abstract the DB interface so I can use for any other database, even if you don't plan it in the next future. I have posted small data store architecture code that may help you.
From a look at your code, I am a bit confused by the naming connect
and connection
and the latter stores $connect
in the constructor. Maybe give a more descriptive names (one of the top recommendations in the mentioned book).
Why are you unsetting
$connect
?The names such as
$LNK_ID
are cryptic for reader.I would reserve a separate class dealing with the database via thin interface (see my post) and let other classes only talk to that class instead of DB directly.
OOP is definitely the way to go. The best advise I can offer is to read the book "Clean Code" by Uncle Bob. The code there is in Java but all principles apply equally to any other language.
I would definitely abstract the DB interface so I can use for any other database, even if you don't plan it in the next future. I have posted small data store architecture code that may help you.
From a look at your code, I am a bit confused by the naming connect
and connection
and the latter stores $connect
in the constructor. Maybe give a more descriptive names (one of the top recommendations in the mentioned book).
Why are you unsetting
$connect
?The names such as
$LNK_ID
are cryptic for reader.I would reserve a separate class dealing with the database via thin interface (see my post) and let other classes only talk to that class instead of DB directly.