/ Published in: PHP

a brief Class of frequently used MySQL functions.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // Define for MySQL ////////////////////////////////////////////// //////////////////////////////////////////////////////// // Class //////////////////////////////////////////////////////// class DB { var $host; // host var $user; // user var $pass; // pass var $db; // MySQL_LinkID var $database; // DB name /////////////////////////////////////////////////////// // construct /////////////////////////////////////////////////////// function DB() { $this->host = LOCALHOST; $this->user = DB_USER; $this->pass = DB_PASS; $this->database = DB_NAME; } /////////////////////////////////////////////////////// // Connection /////////////////////////////////////////////////////// function con() { if ( !$this->db ) { } if (!$db_selected) { } } /////////////////////////////////////////////////////// // Close /////////////////////////////////////////////////////// function close() { } /////////////////////////////////////////////////////// // Query /////////////////////////////////////////////////////// function query($query) { return $res; } } //////////////////////////////////////////////////////// // ShortCut Function //////////////////////////////////////////////////////// // mysql_num_rows function mnr($res) { return $num; } // mysql_fetch_assoc function mfa($res) { return $rec; } // mysql_fetch_array function mfar($res) { return $rec; } ?>
Comments
