[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • Last Modified:

One Big PHP script or several small ones

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
cardilion
Asked:
cardilion
  • 2
1 Solution
 
p_nutsCommented:
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
 
p_nutsCommented:
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

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now