title: Suggestions on implementing PHP object between database
body: <p>Here is something I would like to do:</p>
  
  <pre><code>User:
  id
  first_name
  second_name
  gender
  </code></pre>
  
  <p>and I make a php Object "User", and I modify the "User"'s attribute, I update the database, for example, </p>
  
  <pre><code>$aUser-&gt;setGender("M");
  </code></pre>
  
  <p>in the set gender, I execute an update statement using php... But I got a problems here, if the user only have 4 attributes, it is ok for me to write one by one. But if the object have many attributes, I need to write more update statement....(I can write a general update statement, whatever I change which attribute, I update all the attribute once, but I think it is no point to do so.. ... ) How can I simplify that? Thank you.  </p>