Jump to content

Can u pls check if my class is proper and i'm doing it the right way ?


jd2007

Recommended Posts

<?php
class SearchFeature
{
// local variables
private $sitename;
private $sitedescription;
private $siteaddress;

function searchFeature_constructor($name, $description, $address)
{
     $this->sitename=$name;
 $this->sitedescription=$description;
 $this->siteaddress=$address;
}
//connect to the database
function connectdb($host, $username, $password, $database)
{
     $connect=mysql_connect($host, $username, $password);
 $db=mysql_select_db($database, $connect);
}
// add a site
function addSite($table)
{
      $query="insert into $table ($sname, $sdesc, $sadd) values ($this->sitename, $this->sitedescription, $this->address)";
  $result=mysql_query($query);
}
//get the site's id
function getsiteid()
{
     $query2="select id from $table where $sname=$sitename and $sdesc=$sitedesc and $sadd=$siteadd";
 $result2=mysql_query($query2);
 $row=mysql_fetch_row($result2);
 $id=$row[0];
}
// adds the site id and tags for the site
function addTags($table3, $idc, $tagc, $id, $tag)
{
      $query3="insert into $table3 ($idc, $tagc) values ($id, $tag)";
  $result3=mysql_query($query3);
}

}
?>

This class is for a search feature. it will be used to add a site to the search database and add tags which are related to that site...

 

my class has no destructors...if i want to add, what should i put in it ?

 

stuff related to this ::, _sleep, _wakeup confuse me...what do they do and do i need to add anything like that ?

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.