WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Use this class to connect your database transparently...
Categories : PHP Classes, Databases, PHP Update Picture
Fabien HADDADI
Date : Aug 04th 2000
Grade : 1 of 5 (graded 1 times)
Viewed : 5932
File : dbconnect.cls
Images : No Images for this code example.
Search : More code by Fabien HADDADI
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?
/* 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