Archive for the 'sql' Category
« Previous EntriesNext Entries »
Saturday, August 23rd, 2008
Carrying on from my last post about connecting to an SQL database using PHP, here are the functions I use to open and close database connections (Note: » just extends the line, you’ll need to remove that for this to work correctly).
// to open the database
function connectToDatabase () {
$link = mysql_connect("localhost", "database_name", »
"database_password");
if ($link && mysql_select_db("database_name"));
return ($link);
return (FALSE);
}
// to close the database
function db_close($connecter) {
mysql_close($connecter);
}
It’s a good idea to keep these database connection functions in one place and then reuse them as you need, rather than repeating them everywhere.
Read the rest of this entry »
Posted in php, snippets, sql | 1 Comment »
« Previous EntriesNext Entries »
Social Networking
Keep an eye out for me on Twitter
My name is Steven Clark (aka nortypig) and my passions are business, web development, photography and writing. I have an MBA (Specialisation) and a Bachelor of Computing from the University of Tasmania. I am working as a business management consultant.
My photography is at Steven Clark Studio and my regular photo blog presents an ongoing stream of latest images at Walk a Mile in my Shoes and I'm working on a long-term photography project called the King Island Project.
Site Supporters
Hosted by Brett Drinkwater at Tashosting who is always there at the other end of my every inconvenient question and technical crisis. Brett's local community support for us over the last five years is greatly appreciated.