Associate
- Joined
- 3 Mar 2004
- Posts
- 1,312
- Location
- West London
Hi,
I've googled and checked up a lot of articles on PHP (I used it a bit at university but nothing for making a fully fledged site) and was just wondering what standards people adhere to here?
What I mean is, if your site has multiple tables, do you create PHP classes with functions for each of those tables for example? I write Java EJB code on a daily basis and now I can't see logically why I'd want to just have a scrap of code to say, insert a new user in the page where I want it (signup.php), rather than say having a class for the user table and having all related calls to this table in there?
So I'd have a user php class with all the functions such as sign_up/log_in/log_out etc. Then I'd do the same for say the 'user posts' table. I guess this all sounds very basic but is this how people go about writing their PHP code?
Also, with regards to accessing the database, do people connect in each function and then drop the connection or is there some standard way to do? I'm just a bit confused with what direction to take if making a large scale site...
I've googled and checked up a lot of articles on PHP (I used it a bit at university but nothing for making a fully fledged site) and was just wondering what standards people adhere to here?
What I mean is, if your site has multiple tables, do you create PHP classes with functions for each of those tables for example? I write Java EJB code on a daily basis and now I can't see logically why I'd want to just have a scrap of code to say, insert a new user in the page where I want it (signup.php), rather than say having a class for the user table and having all related calls to this table in there?
So I'd have a user php class with all the functions such as sign_up/log_in/log_out etc. Then I'd do the same for say the 'user posts' table. I guess this all sounds very basic but is this how people go about writing their PHP code?
Also, with regards to accessing the database, do people connect in each function and then drop the connection or is there some standard way to do? I'm just a bit confused with what direction to take if making a large scale site...