|
|
|
<?
/* put this class into a file cls/dbconnect.cls */
/************************************************************************/
class Db {
cfunction connect() {
/*connect db class*/
$host = "me.mydomain.com";
$user = "myuser";
$passwd = "mypassword";
$db = "mydb";
mysql_connect($host,$user,$passwd) or die("Sorry, can't connect to SQL server, please come
later...");
@mysql_select_db("$db");
}
/************************************************************************/
cfunction close() {
/*close connection*/
mysql_close();
}
};
?>
<?
/*this is an example of how to use the above class...*/
require("http://me.mydomain.com/cls/dbconnect.cls");
$myDb = new Db;
/*connect to database*/
$myDb->connect();
/*show entire table*/
$qry = "SELECT * FROM foo";
$result=mysql_query($qry) or die("Error: couldn't execute query 1 ($qry)");
/*use your result...*/
/*disconnect*/
$myDb->close();
?>
|
|
| PHP5 SQLite Abstraction class Categories : PHP, PHP Classes, SQLite, Databases | | | The Ajax Tree view class fetches data from a db for the requested parent category id. The data is then stored in an array and converted into JSON (Javascript Object Notation) format. This format is then used by JavaScript for populating tree view. Categories : PHP, PHP Classes, Java Script, AJAX, Databases | | | PostGreSQL and MySQL 2 in 1 db Manager Categories : PHP, PHP Classes, Databases, PostgreSQL, MySQL | | | [PHP5] aDB PDO LIKE Database Abstraction. Switch easily from one db server to another, strong errors management, manage transactions, queries preparation and more. Categories : PHP, PHP Classes, Databases, MS SQL Server, MySQL | | | Simple class to create insert and update statements. Independent of the access to the database. Makes handling complex inserts easier - especially when the table structure is liable to change. Categories : Databases, PHP Classes, PHP | | | Password reminder Categories : PHP, PHP Classes, Databases, MySQL, Mail | | | Simple class for accessing databases like MSSql Server, Oracle etc by Raju Categories : PHP, MS SQL Server, Databases, PHP Classes, Oracle | | | DbObject - A PHP wrapper for working with various databases Categories : Databases, PHP, PHP Classes | | | Specify your connection settings and create a link to a MySQL database. Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides | | | Online Automatic Class Generator for MySQL Tables Categories : PHP, PHP Classes, Classes and Objects, Databases, MySQL | | | MySQL Connection/Query Class Categories : Databases, MySQL, PHP, PHP Classes | | | MySQL Class to ease Database connectivity Categories : MySQL, PHP Classes, Databases, PHP | | | DBE - Database Expander: Edit PostgreSQL individual database tables online via your Web browser! Categories : PostgreSQL, Complete Programs, Databases, PHP Classes, PHP | | | SQLite PHP Database Wrapper Categories : PHP, PHP Classes, Databases, SQLite, Beginner Guides | | | phpFormGenerator for Dynamic Form Generation from MySQL Categories : PHP, PHP Classes, MySQL, Databases, HTML and PHP | |
|
|