xernt.com




Xernt helps you find up-to-date answers & allows to take a part in building human knowledge database.
This Post below ↓ is only visible to you.
It is sheduled to delete with all the changelog & comment data attached. You can cancel deletion at any time.
4 weeks left
TIP. Editing item cancels the deletion shedule automatically.
DATABASE In PHP, php with database, php database script

DATABASE In PHP, php with database, php database scriptEdit

 
 
Below is the script (DATABASE In PHP, php with database, php database script) I use: /libs/db/index.php:


function pconnect($h, $u, $p, $n) {
$dbh = mysql_pconnect($h, $u, $p);
if(!is_resource($dbh)) die('ENGINE :: X CONNECT TO DB :: '.mysql_error());
if(!mysql_select_db($n)) die('ENGINE :: X SELECT DB :: '.mysql_error());
}

function q($q) {
$r = mysql_query($q);
if(strtolower(substr($q, 0, 6)) == 'select') if(!$r) die('SQL, line '.__LINE__.' :: '.mysql_error()); return $r;
}

function n_r($q) {
return mysql_num_rows($q);
}

function aff() {
return mysql_affected_rows();
}

function cnt($q) {
return mysql_result($q,0,0);
}

function f($r, $f = 'array') {
$fetch = 'mysql_fetch_'.$f;
if($fetch = 'mysql_fetch_array') return $fetch($r, MYSQL_ASSOC); else return $fetch($r);
}

function l_id() {
return mysql_insert_id();
}

?>


It's ideal because you can change database in any moment without affecting the engine code.

A database is a collection of data for one or more multiple uses. One way of classifying databases involves the type of content, for example: bibliographic, full-text, numeric, image. Other classification methods start from examining database models or database architectures: see below. Software organizes the data in a database according to a database model. As of 2010 the relational model occurs most commonly. Other models such as the hierarchical model and the network model use a more explicit representation of relationships.

A number of database architectures exist. Many databases use a combination of strategies. DATABASE In PHP, php with database, php database script
Databases consist of software-based "containers" that are structured to collect and store information so users can retrieve, add, update or remove such information in an automatic fashion. Database programs are designed for users so that they can add or delete any information needed. The structure of a database is tabular, consisting of rows and columns of information.
Online Transaction Processing systems (OLTP) often use a "row oriented" or an "object oriented" data store architecture, whereas data-warehouse and other retrieval focused applications like Google's BigTable, or bibliographic database (library catalog) systems may use a Column oriented DBMS architecture.
Document-Oriented, XML, knowledgebases, as well as frame databases and RDF-stores (also known as triple stores), may also use a combination of these architectures in their implementation.
Not all databases have or need a database schema ("schema-less databases").
Over many years general-purpose database systems have dominated the database industry. These offer a wide range of functions, applicable to many, if not most circumstances in modern data processing. These have been enhanced with extensible datatypes (pioneered in the PostgreSQL project) to allow development of a very wide range of applications.
There are also other types of databases which cannot be classified as relational databases. Most notable is the object database management system, which stores language objects natively without using a separate data definition language and without translating into a separate storage schema. Unlike relational systems, these object databases store the relationship between complex data types as part of their storage model in a way that does not require runtime calculation of related data using relational algebra execution algorithms.

source: en.wikipedia.org/wiki/Database
Edit
Comment · pm1  · 2 years ago
Please login or create an account to post a comment.
Follow Post
Related Posts
2,187 views


 
 
149 online
About · Blog · Explore · Privacy · Terms · Help  up

These items will be permanently deleted and cannot be recovered. Are you sure?