View Full Version : How to create a PHP/MYSQL site at home?
Question for you guys. I currently have sunshop installed and am going to be modifying it. I have picked up bits and pieces of php and mysql but am having a difficult time figuring out how to go about editing. Since my store's products are generated via mysql and remote access is gone, I figured I'll have to install mysql on my home pc, along with php so that I can demo the website locally, and then upload the finished product to the site. But, I'm at a loss on what all needs to be done to acomplish this. I figure I'll need mysql and php at a minimum installed, is that correct? Also are there other programs in addition to install besides all this? Finally is there a nice 'n neat package with all this in it and directions, or a website that explains it all? I know I can edit the php locally and upload it and then test it out, but that's such a hassle; I know there is an easier way to do it out there, but I am not sure what that way is... suggestions?
pilotdoofy
7-15-04, 08:35 PM
You wouldn't have to install php or MySQL to test the site locally before updating remotely. It's very simple, just create a directory and specify it a website. You can just use the hosts you're already signed up for. That's what I do. I use Macromedia Dreamweaver MX 2004 though, makes life a lot easier with php.
First, download all files to your computer. Next you'd need to setup your connect.php file or connection statement (where ever that might be) to use your hosting details, i.e like this.
<?
//get connection information
$dbhost = "mysqlhost.yourhost.com";
$dbusername = "your username for the database";
$dbpassword = "your password for the database";
$dbdatabase = "the database you'll be using";
?>
Now just include that before all php in your pages or save it as a file like connect.php and retrieve it with the include(); or require(); functions built into php.
include ("/your/root/path/connect.php");
or
require ("/your/root/path/connect.php");
I suggest require because it stops all operations if the file was not found. Then to use SQL queries just do like this.
<?
//get the SQL query
mysql_connect($dbhost, $dbusername, $dbpassword);
@mysql_select_db($dbdatabase) or die ("Error: Could not connect to database!");
$query = "SELECT * FROM your_table WHERE yourvariable = $yourvariable";
$result = mysql_query($query);
?>
You don't have to use variables if you don't want. I'm assuming you know how/when to use them and what they accomplish. If you need more help just AIM me at pilotdoofy or email me at mdaniel@mustywindows.com
I hope it works out for you, and I hope I answered your question.
vBulletin v3.6.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.