WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-27-2006, 01:00 PM
WebProWorld Pro
 

Join Date: Jul 2003
Location: Canada
Posts: 263
ackerley1 RepRank 0
Default DW and DB connections?

I am trying to set up Dreamweaver to work with my DB. I am using the phpdev build of PHP, MySQL and Apache, and for the life of me I cannot figure out what I should be putting in the connection fields in DW to make the DB connection work.

If anyone has some experience with this, please help me out.

Rob
__________________
Rob Ackerley
Sovereign Web Design
www.sovereignwebdesign.com
Reply With Quote
  #2 (permalink)  
Old 03-27-2006, 05:56 PM
iany's Avatar
WebProWorld Pro
 

Join Date: Sep 2003
Location: Stirling, Scotland
Posts: 237
iany RepRank 1
Default

Not sure what is so special about Dreamweaver, but connecting to DB is really quite straightforward:

Try:
<?php # - mysql_connect.php

// This file contains the database access information.
// This file also establishes a connection to MySQL and selects the database.

// Set the database access information as constants.
DEFINE ('DB_USER', 'username');
DEFINE ('DB_PASSWORD', 'password');
DEFINE ('DB_HOST', 'host');
DEFINE ('DB_NAME', 'dbname');

// Make the connnection.
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );

// Select the database.
@mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );
?>

save as defs.php or mysql_connect.php or similar, bung in an "includes" folder and then insert into your php at appropriate place,

include ('./includes/yourfile.php');

Ian
__________________
Ian Young
http://www.iyesolutions.co.uk
Reply With Quote
  #3 (permalink)  
Old 03-27-2006, 08:39 PM
bodgekaloopie's Avatar
WebProWorld Member
 

Join Date: Aug 2004
Location: Michigan, USA
Posts: 67
bodgekaloopie RepRank 0
Default

You haven't posted your settings or your error message(s), but a very common error when trying to connect to a database is to input the wrong information for the host setting.

When defining the host try:

DEFINE ('DB_HOST', 'localhost');

Good luck!
Reply With Quote
  #4 (permalink)  
Old 03-31-2006, 12:49 AM
southplatte's Avatar
WebProWorld Veteran
 

Join Date: Jul 2003
Location: Colorado
Posts: 380
southplatte RepRank 1
Default

First you need to clarify - is your problem in the script you are coding, or are you trying to setup the testing/remote server features of DW.

If it is the latter, then the suggestions mentioned will not work, and we need a bit more information before we can offer a solution, such as any errors, what dialog/screen you are on when it happens, etc.

If it is the first one I mention, then the help already offered should handle the request.

Many people who are not familiar with DW will simply tell you how to make your script connect to the DB not knowing that you can connect DW directly to the DB for use during development and testing, and even use the live preview and view the live data right in the design view of DW.
Reply With Quote
  #5 (permalink)  
Old 03-31-2006, 11:30 AM
WebProWorld Pro
 

Join Date: Jul 2003
Location: Canada
Posts: 263
ackerley1 RepRank 0
Default

I was just trying to set it up in the test environment within in DW. Went back to look at it again and get the steps to post here, and played with the settings a bit and made it work.

Writing a connection code is no problem, but I need the testing environment within DW to work too.

Thanks
__________________
Rob Ackerley
Sovereign Web Design
www.sovereignwebdesign.com
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Tags:



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0