Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Noob questions about PHP and MySQL




3:03 pm on Apr 27, 2009 (gmt 0)

5+ Year Member

Hi All,

I've only just started with PHP and MySQL, and I have set up a localhost apache server.

I have a few questions about how best to go about bulding and testing a website that will interface with a database.

At present, I am using PHP scripting, to get(and put) data to a database that I have defined on localhost using phpmyadmin. What happens when I want to "upload" my website?

Do I need to change all the php code to now reference the host's server location?

How do I upload my table? (or must I dynamically create the table on the first load of the site?)

What is the 'best practise' method for building and testing php/mysql websites?

Thanks. :)


3:42 pm on Apr 27, 2009 (gmt 0)

5+ Year Member

You should have 2 instances of your website. One being the development(the testing server) and one the production (the one the world sees). Typically, these are hosted on two servers with identical LAMP/WAMP configurations. You may want to set your "hosts.allow" setting to only let in certain people and block everyone else from your development server. I'm sure other people will have more information, but this will give you something to think about.


9:07 am on Apr 28, 2009 (gmt 0)

5+ Year Member

Thanks d40sithui, this whole project(learning php/mysql/html) has given me plenty to think about!

It's a uniquely rewarding experience when things work, and an unmatched frustration when they don't! :)

I'm glad to have this forum to help me! :)


2:28 pm on Apr 28, 2009 (gmt 0)

5+ Year Member

yeah i know what you mean. i've only been on this for around 2 years and i've learned alot and keep learning more everyday! in regards to your question about moving tables, i think the best way is to do a mysqldump and copy your entire table schema into your target database. phpadmin should have something like this - although i haven't used it (i just ssh into the database via telnet client). good luck and have fun


2:42 pm on Apr 28, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Do I need to change all the php code to now reference the host's server location?

It's definitely worth considering splitting your code down into include files if you haven't already. That way when you have to make a change to something you only have to do it once rather than multiple times. The connection to your database would normally be in an include file for example.


Featured Threads

Hot Threads This Week

Hot Threads This Month