Solved

One Big PHP script or several small ones

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

685 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