PHP中项目的sql查询中的MYSQL列计数错误

$logquery="INSERT INTO new_data_entry_log (directory,ip,description,state,status,instituteid,email,category,bandwidth,project,institutehead,contactnumber,landlinenumber,latitude,longitude,clientip,added by,added on,added at) VALUES ('$directory','$ipaddress','$description','$state','$status','$instituteid','$contactemail','$bandwidth','$institutehead','$contactNumber','$contactlandlinenumber','$latitude','$longitude','$clientip','$name','$currentdate','$currenttime')";

I can see there is a mismatch of columns count and related values count. Probably it might be the issue.

Did you try with removing the single quates of the variables?

I have formated your query.

Formated Query

$logquery="INSERT INTO `new_data_entry_log`(
  `directory`,
  `ip`,
  `description`,
  `state`,
  `status`,
  `instituteid`,
  `email`,
  `category`,
  `bandwidth`,
  `project`,
  `institutehead`,
  `contactnumber`,
  `landlinenumber`,
  `latitude`,
  `longitude`,
  `clientip`,
  `added by`,
  `added on`,
  `added at`
) VALUES(
  '$directory',
  '$ipaddress',
  '$description',
  '$state',
  '$status',
  '$instituteid',
  '$contactemail',
  '$bandwidth',
  '$institutehead',
  '$contactNumber',
  '$contactlandlinenumber',
  '$latitude',
  '$longitude',
  '$clientip',
  '$name',
  '$currentdate',
  '$currenttime'
)";

In your code

new_data_entry_log(19 property)

But

VALUES(17 values)

This is the main reason. Another reason can be data type issue. Because you set all values as String/Varchar

Note: best practice(underscore) for database fields

`added by` --> 'added_by'
`added on` --> 'added_on'
`added at` --> 'added_at'