Posted: Sat Jun 30, 2007 3:05 am
wrote 3 separate class. Admin, Member and Sql
The Sql class contains all the methods of sql statements, like INSERT, DELETE etc.
The Admin contains all the methods which are needed for admin
The Member contains all the methods which are needed for Member
How to connect all? Currenty i created a class called Cls in which i have declared all the methods which are in the 3 classes (Admin, Member and Sql), and redirecting to the relevant class.
for example,
to access member name, which is defined in Member class i will be calling,
In the Cls class,
In the Member class,
In the Sql class,
Which looks clumsy, It should be linked in a better way, can some one give me some idea to link and call the class
The Sql class contains all the methods of sql statements, like INSERT, DELETE etc.
The Admin contains all the methods which are needed for admin
The Member contains all the methods which are needed for Member
How to connect all? Currenty i created a class called Cls in which i have declared all the methods which are in the 3 classes (Admin, Member and Sql), and redirecting to the relevant class.
for example,
to access member name, which is defined in Member class i will be calling,
Code: Select all
$member_obj=new Cls;
$member_obj->memberName($id);Code: Select all
function MemberName($id)
{
return Member :: MemberName($id);
}Code: Select all
function MemberName($id)
{
$name=Sql :: Get($tblName, "WHERE id=$id");
return $name['member_name'];
}Code: Select all
function Get($tblName, $cond)
{
$query=mysql_query("SELECT * FROM $tblName WHERE $cond");
return mysql_fetch_row($query);
}