Take these two blocks of code. It is from a database call that writes a simple record to a table. They are nearly identical, one will work, one won’t. It comes down to a missing comma, can you find which one is wrong? Now I know this is simple, I’ve told you the issue, but I think it will take you a long time to read each code block, check etc. before you find the issue.
CODE A
public function createSeatrial($formData) {
$this->db->query(‘INSERT INTO seatrials (seatrial_vesselName, seatrial_activity, seatrial_length, seatrial_buildYear, seatrial_maxCrew, seatrial_maxPax, seatrial_vhfLicence, seatrial_opLimits, seatrial_from, seatrial_to, seatrial_departDate, seatrial_master, seatrial_dp, seatrial_backupDp, seatrial_owner, seatrial_ownerPermision, seatrial_ownerPermisionDate, seatrial_notes) VALUES (:vesselName, :activity, :vesselLength, :vesselBuildYear, :vesselMaxCrew, :vesselMaxPax, :vhfLicence, :opLimit, :from, :to, :departureDate, :master, :dp, :backupDp, :owner, :permisionType, :ownerDate, :notes)’);
CODE B
public function createSeatrial($formData) {
$this->db->query(‘INSERT INTO seatrials (seatrial_vesselName, seatrial_activity, seatrial_length, seatrial_buildYear, seatrial_maxCrew, seatrial_maxPax, seatrial_vhfLicence, seatrial_opLimits, seatrial_from, seatrial_to, seatrial_departDate, seatrial_master seatrial_dp, seatrial_backupDp, seatrial_owner, seatrial_ownerPermision, seatrial_ownerPermisionDate, seatrial_notes) VALUES (:vesselName, :activity, :vesselLength, :vesselBuildYear, :vesselMaxCrew, :vesselMaxPax, :vhfLicence, :opLimit, :from, :to, :departureDate, :master, :dp, :backupDp, :owner, :permisionType, :ownerDate, :notes)’);