OOP PHP Class Question
Posted: Wed Mar 14, 2007 9:03 am
After another leave home PHP... I'm back. haha
Well I decided that I will writing OOP PHP(4) after reviewing some of my old code...
But I had a question before I do so. I'd like to create a login class along with a mysql class that will work together. How would I write a class that's dependent on another class? I read something about extending a class to another class, is this what I want?
How would I integrate the other class?
Thanks.
Well I decided that I will writing OOP PHP(4) after reviewing some of my old code...
But I had a question before I do so. I'd like to create a login class along with a mysql class that will work together. How would I write a class that's dependent on another class? I read something about extending a class to another class, is this what I want?
Code: Select all
<?php
class Login extends Mysql
{
function checkUsername($username)
{
$data = $mysql->query("SELECT * FROM `blahhh` WHERE username = '" . $username . "' LIMIT 1") or $mysql->raise_error();
if( $mysql->num_rows($data) != 1 )
{
return false;
}
else
{
return true;
}
}
}
?>Thanks.