MySQL Forums
Forum List  »  Connector/ODBC

mySQL connection string
Posted by: rich hemmings
Date: November 06, 2013 11:40AM

Hi Guys Im creating my own website and I have never connected via SQL before only bu using MS Access.

I'm using Heart Internet and Joomla (I'm hard coding this as I'm looking for my first graduate job)I take it with the variables I have to define where my site is, what the name of the website is and the user name and password of the backend of the SQL database?

<?php # Script 7.2 - 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', 'localhost');
DEFINE ('DB_NAME', 'sitename');

// 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() );
?>

Options: ReplyQuote


Subject
Written By
Posted
mySQL connection string
November 06, 2013 11:40AM
November 18, 2013 08:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.