pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

PHP pastebin - collaborative debugging tool View Help


Posted by Stig on Fri 21 Nov 07:29
report abuse | View followups from Dan Storm | download | new post

  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 (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post