0

I am building a web app and I am submitting a form via ajax but I get 500 internal error, I am unable to figure out why it is showing unkown column since the field is present in the database.

A Database Error Occurred Error Number: 1054

Unknown column 'integrity' in 'field list' INSERT INTO reportingofficers_part3 (plannedwork, qualityoutput, analytical, exceptionalwork, overall_workoutput, attitudetowork, responsibility, discipline, communication, leadership, teamspirit, timeschedule, inter_personal, personality, overall_personalattributes, Knowledgeofrules, strategic, decision, coordination, subordinates, handlingproblems, inspection, financialpropriety, overall_functionalcompetency, public_relation, training, health, integrity, reporting_officer_penpicture, overall_numerical_grading, id, reporting-officer-id, set) VALUES ('8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '37' , '35', 1) Filename: models/Login_model.php Line Number: 193

and the snapshot of my reportingofficers_part3 table enter image description here enter image description here

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
Rachid
  • 115
  • 2
  • 12
  • try swapping the order of integrity and health to see if it is position related. I haven't counted but are there enough values? – David G Feb 28 '16 at 06:34
  • strip your UPDATE statement down so that it only updates 'integrity' – David G Feb 28 '16 at 06:43
  • there are total of 33 fields and 33 values and yes the problem is still there and the same when i shifted the position of health and integrity it is still saying unknown column integrity – Rachid Feb 28 '16 at 06:47

3 Answers3

0

Try to add "`" to table name and column names.

INSERT INTO `reportingofficers_part3` (`plannedwork`, `qualityoutput`, `analytical` ...

Additionally try to delete columns list and leave only values in query.

Sebastian
  • 1
  • 2
0

Soln 1: is your id field auto increment ? if so please dont insert value '37' i see that goes to id primary key....and also

Soln 2: You might check your choice of quotes (use double-/ single quotes for values, strings, etc and backticks for column-names)

please see the link for ref

Soln 3: You can Drop that column and recreate that column in the same positon and try again...

i hope above answer will work...all the best

Community
  • 1
  • 1
Farveen Hassan
  • 408
  • 4
  • 12
0

Try to use the backtick character on your columname, You should be aware that some names are usually reserved for mysql

e.g. SET is a reserved word and it has to have a backtick character before performing your MySQL query

follow this link for more detail

Therefore it should be something like

INSERT INTO reportingofficers_part3 (`plannedwork`, `qualityoutput`, `analytical`, 

instead of

INSERT INTO reportingofficers_part3 (plannedwork, qualityoutput, analytical,

More so on the names that have been reserved for MySQL such as SET which you have used and you have not added a backtick onto it

Omari Victor Omosa
  • 2,814
  • 2
  • 24
  • 46