jd2007 Posted August 9, 2007 Share Posted August 9, 2007 <?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); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/64034-can-u-pls-check-if-my-class-is-proper-and-im-doing-it-the-right-way/ Share on other sites More sharing options...
clearstatcache Posted August 9, 2007 Share Posted August 9, 2007 i think so...what's wrong with ds.... Quote Link to comment https://forums.phpfreaks.com/topic/64034-can-u-pls-check-if-my-class-is-proper-and-im-doing-it-the-right-way/#findComment-319172 Share on other sites More sharing options...
JJohnsenDK Posted August 9, 2007 Share Posted August 9, 2007 it looks okay to me... but try to tell us a bit more about what you want the script to do, then we can tell if its right Quote Link to comment https://forums.phpfreaks.com/topic/64034-can-u-pls-check-if-my-class-is-proper-and-im-doing-it-the-right-way/#findComment-319179 Share on other sites More sharing options...
jd2007 Posted August 9, 2007 Author Share Posted August 9, 2007 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/64034-can-u-pls-check-if-my-class-is-proper-and-im-doing-it-the-right-way/#findComment-319194 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.