Skip to content Skip to sidebar Skip to footer

Error When Deleting Or Editing Form Data From Database Using Php And Mysql

Everything in my code seems to work just fine, except when I try to edit/delete already queried data. Delete does nothing... and edit gives me an error shown below: Current code:

Solution 1:

First of all, use prepared Statements to prevent SQL injection. Now to your error:

The table Employer has no column eid:

CREATE TABLE IF NOT EXISTS `Employer` (
  `EmployerID` int(60) NOT NULL,
  `CompName` varchar(60) NOT NULL,
  `Address` varchar(20) NOT NULL,
  `Phone` int(10) NOT NULL,
  `Email` varchar(30) NOT NULL,
  `PosTitle` varchar(30) NOT NULL,
  `Description` varchar(100) NOT NULL,
  `Location` varchar(35) NOT NULL,
  `Skill1` varchar(20) NOT NULL,
  `Experience1` int(10) NOT NULL,
  `Skill2` varchar(20) NOT NULL,
  `Experience2` int(11) NOT NULL,
  `Skill3` varchar(20) NOT NULL,
  `Experience3` int(11) NOT NULL,
  `Need` varchar(15) NOT NULL,
  PRIMARY KEY (`EmployerID`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;

The column name you refering is named EmployerID.

So your statement must be delete from Employer where EmployerID=$eid.

And because employerId is an int not a character field you do not need the single quotes arround.

The same error is in the following select statement.

Then you mix mysqli_* API and mysql_* (mysql_errr()). Change it to mysqli_error

Post a Comment for "Error When Deleting Or Editing Form Data From Database Using Php And Mysql"