<?php
// Copyright Cnet com /*************************************************************************** * connection.inc * * Wed November 17 18:06:45 2004 * Copyright 2004 Maurice Courtois * maurice@phmarket.com ****************************************************************************/ /* /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
// This if file is use by SQL.inc for connecting to the databases. You need many connect function than you have users in your database. // Below an example of a connection function.
function connect_example() { $connect_example = @mysql_connect($GLOBALS['host'], "example_user", "example_pass"); return $connect_example; }
// $GLOBALS['host'] must be set in environment.inc (usualy localhost) // example_user : is the user of your mysql database. // example_password : is the password of your mysql database.
// An example for doing a select, insert, delete or anything else. // $store_res = new select("QUERY TO EXECUTE", "CONNECTION FUNCTION (connect_example())", "The database to connect (default is $GLOBALS['db'])"); // An example // $query = "SELECT * FROM test"; // $store_res = new select($query, "connect_example()"); // You need to put the connection function into double quote and you have to called them exactly what is shown before. // After that you have an array : $store_res->result containing the result of your query.
function fermer_connect($laconnect) { mysql_close($laconnect); } ?>
|