Solved

One Big PHP script or several small ones

Posted on 2010-08-13
2
300 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
how to resize preview image 4 30
Button Click 11 25
Duplicating MySQL Table columns 5 15
Help cleaning out CSS 2 26
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…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

705 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now