Revision: 30560
                            
                                                            
                                    
                                        
Initial Code
                                    
                                    
                                                            
                                    
                                        
Initial URL
                                    
                                    
                                                            
                                    
                                        
Initial Description
                                    
                                    
                                                            
                                    
                                        
Initial Title
                                    
                                    
                                                            
                                    
                                        
Initial Tags
                                    
                                    
                                                            
                                    
                                        
Initial Language
                                    
                                    
                                                    
                        at August 17, 2010 13:36 by jackkeller
                            
                            Initial Code
if ($_SERVER["REMOTE_ADDR"] == "127.0.0.1") {
 
    $l = mysql_connect ("localhost","root","") or die("Error connecting: <br /><br />".mysql_error());
    mysql_select_db("local_db") or die("Error getting db: <br /><br />".mysql_error());
   
    $siteurl = "http://website.dev/"; // WITH TRAILING SLASH!
 
} else {
 
    $l = mysql_connect ("localhost","live_database_user","live_password") or die("Error connecting: <br /><br />".mysql_error());
    mysql_select_db("live_db") or die("Error getting db: <br /><br />".mysql_error());
 
    $siteurl = "http://website.com/"; // WITH TRAILING SLASH!
}
                                Initial URL
http://www.mediaextra.net/2010/workflow/tips-on-local-development/
Initial Description
Here's a little trick I started using when working with XAMPP for localhost and keeping things in tune with the live configuration variables such as username and passwords to mysql (or whatever you're writing for). The example below figures your working on http://website.com and that your local development server uses no password for the database.
Initial Title
PHP Smart Config File
Initial Tags
mysql, php
Initial Language
PHP