Jul 11, 2019 08:51 AM
(This post was last modified: Jul 11, 2019 10:12 AM by Effexion.)
I am trying to make an app to help me trackk my tarantulas. I am getting the following error:
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.
![[Image: gsei0kN.png]](https://i.imgur.com/gsei0kN.png)
SOLVED:
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]](https://i.imgur.com/gsei0kN.png)
SOLVED:
Resident Writer for MyGamer.Com and Horrify.Net


