Lille ændring = fejl ?! hjælp:-)

Tags:    php

Hej

Jeg har tilfølge nedenstående til min database og har derfor også tilføjet dem i min add_player.php, men jeg får følgende fejl : "Column count doesn't match value count at row 1"

Jeg har tilføjet: Nickname, Adresse, Postnr, Trojenr, Mail og Telefonnr.

Koden ser således ud...:

<?
include("../config.php");
if(isset($_POST[Are]))
{
$Page = $_POST[Page];
$Type = $_POST[Type];
$Name = $_POST[Name];
$Nickname = $_POST[Nickname];
$Adresse = $_POST[Adresse];
$Postnr = $_POST[Postnr];
$Born = $_POST[Born];
$Playing_in_GSI_since = $_POST[Playing_in_GSI_since];
$Position = $_POST[Position];
$Favorite_team = $_POST[Favorite_team];
$Favrite_player = $_POST[Favrite_player];
$Trojenr = $_POST[Trojenr];
$Mail = $_POST[Mail];
$Telefonnr = $_POST[Telefonnr];
$Former_clubs = $_POST[Former_clubs];
$About_the_player = $_POST[About_the_player];
$Statistik = $_POST[Statistik];
$Picture = $_FILES[Picture][name];
$t = time();



function getFileExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
$ext = strtolower($ext);
if($ext == jpg || $ext == jpeg || $ext == gif || $ext == png)
{
}
else
{
echo"<strong>$ext</strong> type is not accepted.Please upload only JPG, Gif and PNG Extenstions";
exit();
}
return $ext;
}

function CopyImageFileGD($name,$ext,$path_thumbs,$path_big,$newwidth,$newheight) {
$t = time();
$tempname = strtolower($name);
$Newname = "$tempname$t.$ext";
$Temp_type = $_FILES[$name]['type'];
$Temp_name = $_FILES[$name]['name'];
$Temp_size = $_FILES[$name]['size'];
$Temp_tmp = $_FILES[$name]['tmp_name'];

if($Temp_size){
if($Temp_type == "image/pjpeg" || $Temp_type == "image/jpeg"){
$new_img = imagecreatefromjpeg($Temp_tmp);
}elseif($Temp_type == "image/x-png" || $Temp_type == "image/png"){
$new_img = imagecreatefrompng($Temp_tmp);
}elseif($Temp_type == "image/gif"){
$new_img = imagecreatefromgif($Temp_tmp);
}

list($width, $height) = getimagesize($Temp_tmp);

if (function_exists(imagecreatetruecolor)){
$resized_img = imagecreatetruecolor($newwidth,$newheight);
}
imagecopyresized($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$tempname = strtolower($name);
$Newname = "$tempname$t.$ext";
ImageJpeg ($resized_img,"$path_thumbs/$Newname");
ImageDestroy ($resized_img);
ImageDestroy ($new_img);
move_uploaded_file ($Temp_tmp, "$path_big/$Newname");
}
return $Newname;
}





$ExtPicture = getFileExtension($Picture);




if(!empty($Picture))
{
$NewPicture = CopyImageFileGD("Picture","$ExtPicture","../profiles_files/thumbs","../profiles_files","150","112");
}





$q1 = "INSERT INTO `profiles` (`ProfileID` , `Page` , `Type` , `Name` , `Nickname` , `Adresse` , `Postnr` , `Born` , `Playing_in_GSI_since` , `Position` , `Favorite_team` , `Favrite_player` , `Trojenr` , `Mail` , `Telefonnr` , `Former_clubs` , `About_the_player` , `Picture` ) VALUES ( '', '$Page', '$Type', '$Name', '$Born', '$Playing_in_GSI_since', '$Position', '$Favorite_team', '$Favrite_player', '$Former_clubs', '$About_the_player', '$NewPicture')";
mysql_query($q1) or die(mysql_error());
header("location:profiles.php");
}
else
{
include("header.php");
include("profilesnav.php");
?>
<form name="form1" method="POST" enctype="multipart/form-data" action="addprofiles.php">
<table border="0" width="600">

<tr>
<td width="252">Page:</td>
<td width="549">
<select size="1" name="Page">
<option value="1">Serie 3</option>
<option value="2">Serie 6</option>
<option value="3">Veteran</option>
<option value="4">U-10</option>
<option value="5">U-8</option>
<option value="6">U-7</option>
<option value="7">Stoppede spillere</option>
</select>
</td>
</tr>

<tr>
<td width="252">Type:</td>
<td width="549"><select size="1" name="Type">
<option value="Player">Player</option>
<option value="Coach">Coach</option>
</select>
</td>
</tr>

<tr>
<td width="252">Name:</td>
<td width="549"><input type="text" name="Name" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">Name:</td>
<td width="549"><input type="text" name="Nickname" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">Name:</td>
<td width="549"><input type="text" name="Adresse" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">Name:</td>
<td width="549"><input type="text" name="Postnr" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">Born:</td>
<td width="549"><input type="text" name="Born" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">Playing in GSI since:</td>
<td width="549"><input type="text" name="Playing_in_GSI_since" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">Position:</td>
<td width="549"><input type="text" name="Position" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">Favorite team:</td>
<td width="549"><input type="text" name="Favorite_team" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">Favrite player:</td>
<td width="549"><input type="text" name="Favrite_player" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">Name:</td>
<td width="549"><input type="text" name="Trojenr" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">Name:</td>
<td width="549"><input type="text" name="Mail" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">Name:</td>
<td width="549"><input type="text" name="Telefonnr" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">Former clubs:</td>
<td width="549"><input type="text" name="Former_clubs" size="15" maxlength="50"></td>
</tr>

<tr>
<td width="252">About the player:</td>
<td width="549"><textarea rows="10" name="About_the_player" cols="50"></textarea></td>
</tr>

<tr>
<td width="252">Picture:</td>
<td width="549"><input type="file" name="Picture" size="20"></td>
</tr>


<tr>
<td width="252"> </td>
<td width="549"> </td>
</tr>
<tr>
<td width="252"> </td>
<td width="549"><input type="submit" value="Add Profiles" name="Are"></td>
</tr>
</table>
</form>
<?
include("footer.php");
}
?>



2 svar postet i denne tråd vises herunder
1 indlæg har modtaget i alt 1 karma
Sorter efter stemmer Sorter efter dato
du har glemt at tilføje variablerne med de nye værdier i VALUES i din insert du har kun skrevet deres felt navne ind i inserten.



Nørden>

Hehe rookiemistake! mange tak for hjælpen:-)



t