More efficient way to loop through an object
Indeed there is! Use prepared statements instead of manually escaping and inserting into your query!


  Please, don't use mysql_* functions in new
  code. They are no longer maintained and are
  officially deprecated. See the red
  box? Learn about prepared
  statements instead, and use
  PDO or MySQLi - this
  article will help you decide which. If you choose
  PDO, here is a good tutorial.


//mysqli connection somewhere around here...

if (!empty($school_details_new)) {
    $stmt = mysqli_prepare($conn, "INSERT INTO `SchoolDetails` (`personID`, `School`, `Type`, `End_Date`, `Degree`, `Notes`) VALUES (?, ?, ?, ?, ?, ?)";
    foreach ($school_details as $school) {
        mysqli_stmt_bind_param($stmt, "isssss", $id, $school["school"], $school["qualification"], $school["date_grad"], $school["course"], $school["notes"]);
        mysqli_stmt_execute($stmt);
    }
}