About Draicone Expertise I can answer almost all things related to php, and have years of experience coding for almost any situation. Snippets and bug fixes are the most common issues I deal with.
Experience For the past four years I have been coding in php for various purposes. My recent uses of the skill have been in coding for xtraticwar.com, an online game written entirely in php that has allowed me to make use of my various experience with the language. For mathematical purposes I once turned an algorithm relating to probability into php code to calculate all possibilitie
Organizations None.
Publications School newsletters, general publications.
Education/Credentials None related to the category.
Awards and Honors None related to the category. However, I won the 2006 ICAS Computer Skills competition.
Past/Present clients XtraticWar.com, LogicZero.net, Combobularity@SPLC (a toastmasters public speaking club requiring a web presence).
Question hi there,
i need a decent database class for php5, it's for a CMS I'm writing. any ideas?
thanks, SA
Answer Looks like you're in luck - not only am I online, i have the perfect answer for you. The DB class I generally use is this:
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$dbname = "dbname";
class mysql {
function connect() {
$connect = mysql_connect($dbhost,$dbuser,$dbpass);
if(!$connect) {
die("Cannot connect to mySQL Host.");
} else {
$select = mysql_select_db($dbname);
if(!$select) {
die("Cannot connect to DB.");
} else {
return $select;
}
}
}
function query($info) {
return mysql_query($info);
}
function fetch($info) {
// return mysql_fetch_array($info);
}
function num($info) {
return mysql_num_rows($info);
}
function lastinsert() {
return mysql_insert_id();
}
function affected() {
return mysql_affected_rows();
}
function close() {
return mysql_close();
}
}
$db = new mysql;
$db->connect();
It's very efficient. Things to remember include:
* Always $db->close() at the end of your script
* $db->fetch($db->query("SELECT * FROM *")) to grab arrays
Hopes this helps.