Return to Snippet

Revision: 3037
at May 27, 2007 10:20 by llbbl


Updated Code
<?php
class dbconnect {

  function Connect($DBHOST, $DBUSER, $DBPASS, $THEDB){

  $connection = mysql_connect("$DBHOST","$DBUSER","$DBPASS");
  mysql_select_db("$THEDB", $connection);

  }//ends the connection function

  function Close(){

  mysql_close($connection);

  }//ends the close function

  function FetchRow($query){
  $rows = mysql_fetch_row($query);
  return $rows;
  }

  function FetchArray($query){
  $array = mysql_fetch_array($query);
  return $array;
  }

  function FetchObject($query){
	$array = mysql_fetch_object($query);
	return $array;
}

  function FetchNum($query){
  $num = mysql_num_rows($query);
  return $num;
  }

  function Query($sql){
  $query = mysql_query($sql) or die(mysql_error());
  return $query;
  }//ends the query function

  }//ends the class
?>

Revision: 3036
at May 25, 2007 15:03 by llbbl


Initial Code
<?php
class dbconnect {

  function Connect($DBHOST, $DBUSER, $DBPASS, $THEDB){

  $connection = mysql_connect("$DBHOST","$DBUSER","$DBPASS");
  mysql_select_db("$THEDB", $connection);

  }//ends the connection function

  function Close(){

  mysql_close($connection);

  }//ends the close function

  function FetchRow($query){
  $rows = mysql_fetch_row($query);
  return $rows;
  }

  function FetchArray($query){
  $array = mysql_fetch_array($query);
  return $array;
  }

  function FetchObject($query){
	$array = mysql_fetch_object($query);
	return $array;
}

  function FetchNum($query){
  $num = mysql_num_rows($query);
  return $num;
  }

  function Query($sql){
  $query = mysql_query($sql) or die(mysql_error());
  return $query;
  }//ends the query function

  }//ends the class
?>

Initial URL

                                

Initial Description

                                

Initial Title
MySQL Database Class

Initial Tags
mysql, database, class, php

Initial Language
PHP