Jump to content

profile class feedback please.


xjasonx

Recommended Posts

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

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.