Skip to main content
Participating Frequently
May 29, 2013
Question

automating connection string to mysql?

  • May 29, 2013
  • 1 reply
  • 524 views

I've just started to venture into some of my own php scripts that don't not follow the step by step beginner tutorials. What I can't seem to understand though is how do you get dreamweaver to automatically write the script to establish a database connection.  I've connected to the database by going to  DataBase -> Connect and inputting the settings in the dialogue box.  DW acknowleges that the connection exists.  But it doesn't automatically write the code to facilitate the connection, ie

$hostname_conntest = "my_hostname";

$database_conntest = "my_db";

$username_conntest = "my_username";

$password_conntest = "my_password"; etc..

I have to first create a record set to get this connection code written and then it seems to include about 25 more lines of code that don't seem necessary for what I'm trying to do, such as inserting magicquotes formula and so on. 

does anyone know a simple one button solution to get the very basic connection settings to write to the source code of a new php doc.? 

Thank you.

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Legend
May 29, 2013

I usually just put the connection details in a stand alone file and use an include file in each page which needs a database connection

<?php include('database_connection.php'); ?>