<?php
/**
* Hamed Page maker
*/
//Mysql have some functions that we can make them as a class
class db
{
var $sql;
//for read mysql_query we use $db->sql();
function sql($sql)
{
mysql_query($sql) or die(mysql_error());
}
//for use mysql_fetch_array we use $db->fetch();
function fetch($sql)
{
mysql_fetch_array($sql) or die(mysql_error());
}
//for count rows we use $db->nums();
function nums($sql)
{
mysql_num_rows($sql) or die(mysql_error());
}
}
?>
You need to create an instance of your class before any of the member functions/data will exist -
PHP Code:
$db = new db;
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???