title: PHP function with parameters to update all columns in MySQL table but don't require all parameters and don't always update all columns
body: <p>I have a MySQL table with columns:</p>
  
  <pre><code>opID, opDateAdded, opLastUpdated, opUser, opPropertySaleID, opArray, refurbID, opRefurbCost, opViewingArranged, opOfferAccepted, opOfferAcceptedID, opPaon, opStreet, opPostcode, opPropertyType, opViewingDate, opViewingBy, opViewingPersonName, opFloorArea, opBedrooms, opBathrooms, opReceptions, opAskingPrice, opValuation, opOptMatchingBedrooms, opOptMatchingBuild, opOptMatchingType, opOptSimilarFloor, opOptDistance, opLatitude, opLongitude, opNotes
  </code></pre>
  
  <p>I want to have one function that allows me to update the columns of this table but sometimes only 3-4 columns will need updating, not always all of them.</p>
  
  <p>I'm just wondering what the best method of approaching this is?</p>
  
  <p>I could create a function like:</p>
  
  <pre><code>function updateOpportunity($opID, $opDateAdded, $opLastUpdated, $opUser, $opPropertySaleID, $opArray, $refurbID, $opRefurbCost, $opViewingArranged, $opOfferAccepted, $opOfferAcceptedID, $opPaon, $opStreet, $opPostcode, $opPropertyType, $opViewingDate, $opViewingBy, $opViewingPersonName, $opFloorArea, $opBedrooms, $opBathrooms, $opReceptions, $opAskingPrice, $opValuation, $opOptMatchingBedrooms, $opOptMatchingBuild, $opOptMatchingType, $opOptSimilarFloor, $opOptDistance, $opLatitude, $opLongitude, $opNotes) {
     //update
  }
  </code></pre>
  
  <p>And set them as optional then check if they're set or not, if they are then update those rows (using IFNULL in MySQL)</p>
  
  <p>Or maybe it's better and tidier to create a property class and pass in a property:</p>
  
  <pre><code>function updateOpportunity($property) {
     //update
  }
  </code></pre>
  
  <p>I'm just wondering if there is a standard for creating a function to update a large set of columns that aren't always in need of updating at the same time.</p>