Refactor
:my
=>
'code'
Codes
Refactorings
Popular
Best
Submit
Spam
Account
Logout
Login
JavaScript doesn't seem to be activated, expect things to be ugly and sloppy!
Learn How to Create Your Own Programming Language
createyourproglang.com
Recent
Simple Particle Engine for a shooter game
Snake / Nibbles clone in C and Ncurses
Please improve
Parsing of XML data has high CPU usage
Convert simple Javascript to jQuery plugin
Active Record getting unique records
List the files in a directory without the directory name or the extension
clean the code
ohs system, recruitment software, hr software, oh&s software, human resources software, ohs software
Array parsing in a block
Popular
Parsing of XML data has high CPU usage
Please improve
Snake / Nibbles clone in C and Ncurses
List the files in a directory without the directory name or the extension
Convert simple Javascript to jQuery plugin
Simple Particle Engine for a shooter game
Active Record getting unique records
Breadth first cartesian product iterator
php refactoring
first BST
Pastable version of
php mysql wrapper begginer
<pre class='prettyprint' language='php'><?php if (!defined('ANTIHACK')) { header('HTTP/1.0 403 Forbidden'); header('Status: 403 Forbidden'); die ("<br> You don't have access here."); } Class MySQL { var $dbConfigInfo; var $connect; var $row; public static function connect($dbConfigInfo = NULL) { static $connect; if (!is_array($dbConfigInfo) || count($dbConfigInfo) < 1) return FALSE; if (! isset ($connect)) { $connect = mysql_connect($dbConfigInfo['servername'], $dbConfigInfo['username'], $dbConfigInfo['password']); return $connect; } } public static function db($dbname) { $db = mysql_select_db($dbname) or die(mysql_error()); return $db; } public static function query($query) { return mysql_query($query, $connect); } public static function FetchArray($result = '') { return $row = mysql_fetch_array($result, MYSQL_BOTH); } } ?> and this is how i use it <?php $dbConfigInfo = array( 'servername' => 'localhost', 'username' => 'root', 'password' => '', 'dbname' => 'gallery', ); define('TBL_PRODUCTS', 'sometable'); define('TBL_CATEGORYS', 'sometable'); DEBUG ? error_reporting(E_ALL | E_STRICT) : error_reporting(0); if(!class_exists('MySQL')) include_once('classes/mysql.class.php'); $connect = MySQL::connect($dbConfigInfo); if(!$connect) die("Nu m-am putut conecta"); // TODO : Modificare erroare handler errori custom $db_select = MySQL::db($dbConfigInfo['dbname']); if(!$db_select) die("Nu am ptutu selecta."); // TODO : Modificare erroare handler errori custom ?></pre> <a href="http://www.refactormycode.com/codes/812-php-mysql-wrapper-begginer" style="color:#fff" title="As seen on RefactorMyCode.com"><img alt="Small_logo" src="http://www.refactormycode.com/images/small_logo.gif" style="border:0" /></a>