Jump to content

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


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 ?

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.