xjasonx Posted March 26, 2009 Share Posted March 26, 2009 I'm just getting into OOP and I'm wondering if I'm heading in the right direction with this class I'm building. I'd appreciate any input. class profile { //variables $id; $user; $fname $lname; $email; $posts; $sig; $img; $scripts; $articles; $tutorials; function getProfileInfo($id) { $sql = "select * from users where id='$id'"; $result = mysql_query($sql); $row = mysql_fetch_row($result); //set profile variables $this->$id = $row[0]; $this->$fname = $row[1]; $this->$lname = $row[2]; $this->$email = $row[3]; $this->$posts = $row[4]; $this->$sig = $row[5]; $this->$user = $row[6]; $this->$scripts = $row[10]; $this->$articles = $row[11]; $this->$tutorials = $row[12]; $this->$img = $row[13]; } } Link to comment https://forums.phpfreaks.com/topic/151293-profile-class-feedback-please/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.