Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

225
Views
MYSQL column count doesnt match with value count at row 1 nodejs

I know there are many questions like this but I genuinely don't know whats wrong. I have a table with 4 columns (Id, teacherId, class, attendanceRecord). The Id column is auto incrementing. This is the backend:

app.post("/api/attendanceRecord", async(req, res) => {
    const students = req.body.students
    const className = req.body.className
    const teacherId = req.body.teacherId

    connection.query(
        "INSERT INTO attendance(teacherId, class, attendanceRecord) VALUES(?,?,?)",
        [teacherId, className, students],
        (err, result) => {
            if (result){
                res.send({ message: result })
            } 
            if (err){
                res.send({ message: err })
                console.log(err)
            }
        }
    )
})

This is the front end:


  const updateAbsent = () => {
    Axios.post("http://localhost:1337/api/attendanceRecord", {
      teacherId: teacherId,
      className: className,
      students: students
    }).then((response) => {
    if(response){
      console.log(response)
    } else{
      console.log("error")
    }
  })

  }

attendance table:

CREATE TABLE attendance(
    ID INT auto_increment,
    teacherId INT,
    class varchar(255),
    attendanceRecord VARCHAR(1000),
    PRIMARY KEY(ID)
);

Any help would be appreciated

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!