PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, January 20, 2022

[FIXED] i recieve an error in mysql DB saying "#1136 column count doesn't match value count at row 1"

 January 20, 2022     database, mysql, phpmyadmin, sql     No comments   

Issue

I'm currently trying to enter values inside my table "user" via phpmyadmin and that's when I receive an error "#1136 column count doesn't match value count at row 1"

"user" table

but this error only seems to occur when I have the following trigger entered in my DB, without it the insert works everytime:

This is the trigger

and this is the table I want to actually "influence" via the trigger above:

"ranking" table

what i want to do is take the "username" from the table "user" , and the "points" also from "user" table and insert the same values inside the table ranking after every insert into the "user" table


Solution

When you use INSERT, always include the column names:

INSERT INTO ranking (col1, col2)  -- whatever the columns are
    VALUES (new.points, new.username);

I am not sure what user.points and user.username are supposed to be. I imagine you want to include the new values in the ranking table.



Answered By - Gordon Linoff
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing