Solved

One Big PHP script or several small ones

Posted on 2010-08-13
2
303 Views
Last Modified: 2013-12-13
I am new to programming, but here it goes. I am building a flex web application that connects to a mysql database using PHP. I currently use two diffrent styles to send data back and forth, Http Service & the built in data services. I find that Http service is by far the easiest way to go for me, but I have run into a situation Im not sure about. Would it be better to have a few big PHP files with a lot of code in them, or several smaller php files that have the diffrent services broken up.

For instance if i have table A & table B in my database i could make one php file for each table or should I combine them and use a bunch of if commands.  

Either way would work for me I am just looking for best practices.
0
Comment
Question by:cardilion
  • 2
2 Comments
 
LVL 13

Accepted Solution

by:
p_nuts earned 125 total points
ID: 33432800
have a look at classes and functions... for example I use a mysql class and a table class they deliver the content ... I just create a query and call the classes.. if I don't want a table but a list I can just change 1 line.

so multiple files yes. short functions in object oriented classes yes.

inline script as little as possible. try to make functions you can re-use
0
 
LVL 13

Expert Comment

by:p_nuts
ID: 33432996
have a look at classes and functions... for example I use a mysql class and a table class they deliver the content ... I just create a query and call the classes.. if I don't want a table but a list I can just change 1 line.

so multiple files yes. short functions in object oriented classes yes.

inline script as little as possible. try to make functions you can re-use
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question