Recent Posts
PHP | 4 sec ago
PHP | 23 sec ago
Bash | 33 sec ago
C | 37 sec ago
C++ | 38 sec ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Stig on the 21st of Nov 2008 07:29:08 AM Download | Raw | Embed | Report
  1. <?php
  2.  
  3. class database {
  4.  
  5.         function db_connect($server, $user, $pass, $database) {
  6.  
  7.                 $link = mysql_connect($server, $user, $pass);
  8.                 if(!$link) {
  9.                         die("Could not connect: " . mysql_error());
  10.                 }
  11.  
  12.                 $db_selected = mysql_select_db($database);
  13.                 if(!$db_selected) {
  14.                         die("Could not select database: " . mysql_error());
  15.                 }
  16.         }
  17.  
  18. }
  19.  
  20.  
  21. class sql_query {
  22.  
  23.  
  24.         function query($sql) {
  25.  
  26.                 $sql = mysql_query($sql);
  27.                 if(!$sql) {
  28.                         die("mysql_query error: " . mysql_error());
  29.                 }
  30.  
  31.         }
  32.  
  33.         function getQuery($from, $what="*") {
  34.  
  35.                 $sql = "SELECT $what from $from";
  36.                 $this->query($sql);
  37.  
  38.         }
  39.  
  40.         function insert($what, $column, $value) {
  41.  
  42.                 $sql = "INSERT INTO $what ($column) VALUES ($value)";
  43.                 $this->query($sql);
  44.         }
  45.  
  46. }
  47. ?>
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: