Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Column count doesn't match value count at row 1 [SOLVED]

I am trying to make an app to help me trackk my tarantulas. I am getting the following error:

Quote:Column count doesn't match value count at row 1


I know this obviously means that I am trying to pass too many values into too few columns but I have counted, and recounted and no joy. My "id" column is AI so that shouldn't even come into play here.


PHP Code

<?php
function create(){
 
   global $connection;
 
   $genus = $_POST['genus'];
 
   $species = $_POST['species'];
 
   $lstFed = $_POST['lastFed'];
 
   $lstHouse = $_POST['rehousedOn'];
 
   $lstMolt = $_POST['lastMolt'];
 
   $temper = $_POST['temper'];
 
   $lstSub = $_POST['lstSub'];
 
   $query = "INSERT INTO spiders(genus, species, lastfed, lastrehouse, lastsub, temper, molt)"; $query .= "VALUES ('$genus', '$species', '$lstFed', '$lstHouse', '$lstSub,' '$temper', ";
 
   $query .="'$lstMolt')";
 
       
    $result 
= mysqli_query($connection, $query);
 
   if(!$result){
 
       die("<h1>FAILED TO ADD VALUE</h1>" . mysqli_error($connection));
 
   }
 
   else{
 
       echo "<h1>SPIDER ADDED TO THE DATABASE</h1>";
 
   }
}
?>

[Image: gsei0kN.png]

SOLVED:

[Image: fcTnpRx.png]
Resident Writer for MyGamer.Com and Horrify.Net
Could you show value of query before you try to execute it, it would make debugging easier.

(Jul 11, 2019 09:04 AM)SIM-574702 Wrote:  Could you show value of query before you try to execute it, it would make debugging easier.

At the risk of sounding like an idiot...what do you mean?
Resident Writer for MyGamer.Com and Horrify.Net


Possibly Related Threads...
Thread / Author Replies Views Last Post
by funtelaDec 4, 2021 04:21 PM 10 298 Dec 4, 2021 04:21 PM
Last Post: funtela
by IvexJun 20, 2018 12:21 PM 4 127 Jun 20, 2018 12:21 PM
Last Post: Ivex
by MaradonnieMar 14, 2018 08:38 PM 1 119 Mar 14, 2018 08:38 PM
Last Post: ryan⚜