• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

How to publish database-driven website?

watdahel

Golden Member
I'm new to databases. I needed a Comments Form on my website so readers can leave me feedbacks on articles. The tutorial I followed used Xampp to install a local PHP and MySQL server on my working PC. I also used Dreamweaver and was able to make connections to the local server to test my website database was working. My question is what do I do now in order to publish my site without breaking the connection to the database? Do I upload my site and simply import the database in my host server?
 
You'd need to do two things:

1) Change all places on your website where you connect to your database and ensure it's pointing to the right place, right credentials, etc. I usually make this easy by creating a connect.php file that contains a function that creates a connection to the database for me. Then I just include this file in any main PHP file that needs a connection.

2) You need to export your current database and import it. You could also just recreate the database structure since I assume any test values aren't really needed.
 
Is there a way to connect my web hosts server with Dreamweaver instead of using the Xampp so I don't have to export and import the database?
 
I'm new to databases. I needed a Comments Form on my website so readers can leave me feedbacks on articles. The tutorial I followed used Xampp to install a local PHP and MySQL server on my working PC. I also used Dreamweaver and was able to make connections to the local server to test my website database was working. My question is what do I do now in order to publish my site without breaking the connection to the database? Do I upload my site and simply import the database in my host server?

Yes, that's exactly what you do. Upload the Xampp files to the appropriate directory on your server. You can then import the database using a web-based tool like "phpmyadmin" if you need to.

It sounds to me like you're just setting this up and have no actual data in your database yet, so if your database is empty then I'm pretty sure Xampp has some kind of install script that automatically creates the database, tables and populates it with test content. You can then delete the test content after you verify it's all working and start allowing users to post their comments...but be prepared to deal with comment spam. Enable some kind of captcha if its available on Xampp.
 
Is there a way to connect my web hosts server with Dreamweaver instead of using the Xampp so I don't have to export and import the database?

Xampp is the backend. It supports PHP and MySQL. I would suggest creating an includes files which was suggest.

<?php
includes ('Location:connection.php')?>

Than add your db connection in there. You would only need to upload the includes file.

PM me and I can send you examples.
 
Yes, that's exactly what you do. Upload the Xampp files to the appropriate directory on your server. You can then import the database using a web-based tool like "phpmyadmin" if you need to.

It sounds to me like you're just setting this up and have no actual data in your database yet, so if your database is empty then I'm pretty sure Xampp has some kind of install script that automatically creates the database, tables and populates it with test content. You can then delete the test content after you verify it's all working and start allowing users to post their comments...but be prepared to deal with comment spam. Enable some kind of captcha if its available on Xampp.

I just put up a blog and I'm getting tons of spam.

A captcha is not included with Xampp. You will have to find a plugin for this. Xampp is not a framework like CakePHP or the many others. It's just a program that installs

PHP\MySQL\phpmyadmin\filezilla and something else I don't remember.

You have a neat little server on your pc 🙂
 
I looked in my local directory and found the connections php file was created for me. Since this file contains private data and it will reside on the server, how do I protect the file so it's not accessible to anyone else? Currently, I can browse the directories of my website using a web browser and see the connections php file listed in the directory.

It was suggested to me that I could integrate Wordpress with my website and then I don't have to worry about spammers. My concern is it may be more complicated to integrate Wordpress so it looks like my website. The Forms I'm currently using to collect reader comments satisfy my needs. My site code is so minimal that if I add Wordpress it will bulk up my code.
 
I looked in my local directory and found the connections php file was created for me. Since this file contains private data and it will reside on the server, how do I protect the file so it's not accessible to anyone else? Currently, I can browse the directories of my website using a web browser and see the connections php file listed in the directory.

Assuming you are using Apache, create or edit the file .htaccess in the main web folder (i.e. /public_html or /www) and add this line:

DirectoryIndex index.php default.php index.html

This tells apache to scan the folders for one of the files listed above, and to display it instead of displaying the directories and files. Obviously, the main Xampp file should be on that list.

It was suggested to me that I could integrate Wordpress with my website and then I don't have to worry about spammers. My concern is it may be more complicated to integrate Wordpress so it looks like my website. The Forms I'm currently using to collect reader comments satisfy my needs. My site code is so minimal that if I add Wordpress it will bulk up my code.

Wordpress is blog software and you could use it, but you'd need to edit its templates to get it to look like the rest of your site. You can sign up for a free recaptcha account, which will let you easily add a captcha to the add comments page.
 
Back
Top