Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Integrating PHP with Databases Querying the Database with PHP Working with Results

Matthew Root
Matthew Root
5,392 Points

php database testing

When building my app and integrating it with a database. How do you recommend demo-ing my code? Should I run it through the server or should I test locally via wamp? Does it matter? Any recommendations on how to link your database with wamp for testing purposes?

index.php
<?php
include "helper.php";

/* 
 * helper.php contains
 * $results->query("SELECT member_id, email, fullname, level FROM members");
 */

Depends on your situation.

Sometimes it is more confortable to work remotely on a server, and that's okey (as long as you have an application instance for production, and another for development) if you need to remote work from more than one computer in which you cannot install the required software.

However, keep in mind that you would need to be able to run your application in separate instances for production, testing and development purposes.

Another different question is where to install the database server. If you're planning to develop your app locally, and connect to a remote database server, you may find some problems if there is so much latency between your local PC and your server, anyway, it can be ok if your application size is small, and the connection between PC and server is okey. But my personal recommendation is to have full independent instances for every purpose.

Obviously, that's a personal opinion, and it can be different in some specific cases, but is always a great idea to have different environments for development and production. Some solutions as codeanywhere or heroku (among others) provides containers for development purposes, it can be a great way for developing using a remotely system!

2 Answers

Matthew Root
Matthew Root
5,392 Points

Thanks Oriol! I really appreciate you taking the time to help me. So, when you say different environments for development and production, what do you mean by environment? I understand that development means a person's individual work in developing new code and production meaning the finish product. But what do you mean by environment? Sorry I am new to all of this. Thanks!

Hello again Matthew!

Don't worry if you have not understood something. Software development is a huge world, and it's normal to learn new concepts and new ways to do the things! So, don't feel needed to apologize yourself =)

When i said "environment" I was referring to a complete system that can execute the application. So, a "complete" environment is a system with all software installed and configured, ready to execute your app!

Note that when you follow Internet tutorials and guides, you will see the environment word a lot, and it probably refers to the system requirements for following the tutorial or the documentation.

P.S: You understood nicely what development and production is! Production means the finish product, running on a system that's prepared for ensure the best end-user experience, and development is the same, but prepared for ensure the best developer experience. There are little differences, for example: Probably you will not need to install debugging tools on a production environment, but you will need it on a development environment. Also, if you've created a huge app, you will need to provide a fast and scalable production environment (with more than one server for distributing the work load, among other possible measurements), that will be only needed on a production environment, because on your development environment you won't need to balancing the work load, 'cause you will be the only person working on that system.

I hope i made myself clear. Let me know if I can help you in anything more.

Regards!