Jump to content

theagemaway

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

theagemaway's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hey i gots a question. im not that great at PHP, but im workin at it. can anyone tell me if this is possible? Im making a game out of PHP/HTML, and what I want to do is store all the users and all the variables associated with that user in a MySQL table. simple, easy. now the tricky part is this. I want to load any certain user out of mysql and make that user into an object, and preserve all the columns that represent all the variables of that user. here's what I mean sql table:[font=courier] |----------|------|-------| | username | pass | email | |----------|------|-------| |-theagema-|-way--|-bob@y-| |----------|------|-------| [/font] I want to be able to do something like $guy = new User($POST_['username']); echo $guy->username . "<br />"; echo $guy->pass . "<br />"; echo $guy->email . "<br />"; results in theagema way bob@y this is what i have so far. --- code --- class user { public $username; public $userinfo; function __construct($username) { $this->username = $username; $query = "SELECT * FROM users WHERE username='$this->username'"; $result = mysql_query($query); $userinfo = mysql_fetch_array($result); } } --- end code --- i dont think i have that code correct. but anyways, can someone help me devise a way to do this dynamically, and effectively? thanks :)
×
×
  • 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.