Jump to content

Column count doesn't match value count at row 1 (Prolly easy, Im just a total no


Recommended Posts

Hi!

Needing som help my friends. Never coded in PHP before just got this from a friend a while ago. Anyone knows how to fix it? Hehe..

 

When im trying to register (visiting the "blimedlem.php"-file (aka register.php) I get the error:

Column count doesn't match value count at row 1

 

 

The register file containts the phpcode:

<?PHP
include("settings.php");
if(@$_POST['skicka']) {
if (!isset($_POST['accepterar'])) { ?>
<table width="100%" border="0" cellspacing="0">
<tr>
<td valign="top" width="100%" height="16" background="fx/header.gif"> <span class="rubrik">Du måste acceptera stadgarna för att bli medlem!</span></td>
</tr>
</table><br>
<? } elseif ($_POST['fornamn'] == "") { ?>
<table width="100%" border="0" cellspacing="0">
<tr>
<td valign="top" width="100%" height="16" background="fx/header.gif"> <span class="rubrik">Du måste skriva in ditt förnamn för att bli medlem!</span></td>
</tr>
</table><br>
<? } elseif ($_POST['efternamn'] == "") { ?>
<table width="100%" border="0" cellspacing="0">
<tr>
<td valign="top" width="100%" height="16" background="fx/header.gif"> <span class="rubrik">Du måste skriva in ditt efternamn för att bli medlem!</span></td>
</tr>
</table><br>
<? } elseif ($_POST['personnr'] == "") { ?>
<table width="100%" border="0" cellspacing="0">
<tr>
<td valign="top" width="100%" height="16" background="fx/header.gif"> <span class="rubrik">Du måste skriva in ditt personnummer för att bli medlem!</span></td>
</tr>
</table><br>
<? } elseif ($_POST['adress'] == "") { ?>
<table width="100%" border="0" cellspacing="0">
<tr>
<td valign="top" width="100%" height="16" background="fx/header.gif"> <span class="rubrik">Du måste skriva in din adress för att bli medlem!</span></td>
</tr>
</table><br>
<? } elseif ($_POST['postnr'] == "") { ?>
<table width="100%" border="0" cellspacing="0">
<tr>
<td valign="top" width="100%" height="16" background="fx/header.gif"> <span class="rubrik">Du måste skriva in ditt postnummer för att bli medlem!</span></td>
</tr>
</table><br>
<? } elseif ($_POST['postort'] == "") { ?>
<table width="100%" border="0" cellspacing="0">
<tr>
<td valign="top" width="100%" height="16" background="fx/header.gif"> <span class="rubrik">Du måste skriva in din postort för att bli medlem!</span></td>
</tr>
</table><br>
<? } elseif ($_POST['telefonnr'] == "") { ?>
<table width="100%" border="0" cellspacing="0">
<tr>
<td valign="top" width="100%" height="16" background="fx/header.gif"> <span class="rubrik">Du måste skriva in ditt telefonnummer för att bli medlem!</span></td>
</tr>
</table><br>
<? } elseif ($_POST['anvandarnamn'] == "") { ?>
<table width="100%" border="0" cellspacing="0">
<tr>
<td valign="top" width="100%" height="16" background="fx/header.gif"> <span class="rubrik">Du måste skriva in ett användarnamn för att bli medlem!</span></td>
</tr>
</table><br>
<? } elseif ($_POST['losenord'] == "") { ?>
<table width="100%" border="0" cellspacing="0">
<tr>
<td valign="top" width="100%" height="16" background="fx/header.gif"> <span class="rubrik">Du måste skriva in ett lösenord för att bli medlem!</span></td>
</tr>
</table><br>
<? } elseif ($_POST['mail'] == "") { ?>
<table width="100%" border="0" cellspacing="0">
<tr>
<td valign="top" width="100%" height="16" background="fx/header.gif"> <span class="rubrik">Du måste skriva in mail för att bli medlem!</span></td>
</tr>
</table><br>
<? } else {
$recruit = @$_GET['rID'];
$pw = md5($_POST['losenord']);
$status = "Medlem";
$anvandarnamn = $_POST['anvandarnamn'];
$rang = "1";
$bild = "nopic.jpg";
$datum = time();
mysql_query("insert into $anvandare values ('NULL', '" . $anvandarnamn . "', '" . $pw . "', '".$_POST['fornamn']."', '".$_POST['efternamn']."', '".$_POST['personnr']."', '".$_POST['kon']."', '".$_POST['adress']."', '".$_POST['postnr']."', '".$_POST['postort']."', '".$_POST['telefonnr']."', '".$_POST['mail']."', '" . $rang . "', '" . $status . "',  '".$_POST['accepterar']."', '" . $bild . "', '', '" . $datum . "', '" . $datum . "')")
or die("Det gick inte att lägga till spelaren för att: ".mysql_error());
$nyttid2 = mysql_query("SELECT * FROM $anvandare WHERE anvandarnamn = '" . $_POST['anvandarnamn'] . "'") or die ("Det gick inte att hämta spelaren som rekryterades.");
$nyttid = mysql_fetch_array($nyttid2);
$nyttidn = $nyttid['aID'];
mysql_query("insert into $rekrytering values ('" . $recruit . "', '" . $nyttidn . "', '" . $datum . "')") or die ("Det gick inte att rekrytera för att: ".mysql_error());
?> <script>location.href="index.php";</script> <?
}} ?>

<script LANGUAGE="javascript">
<!--
function popup_stadgar(id)
{
warning = window.open(id,'','toolbar=0,directories=0,location=0,status=0,menubar=0,resizable=1,scrollbars=1,copyhistory=0,width=600,height=400');
}
//-->
</script>

<body> 
<table width="100%" border="0" cellspacing="0">
<tr>
<td valign="top" width="100%" height="16" background="fx/header.gif"> <span class="rubrik">Bli Medlem </span></td>
</tr>
</table><br>
<form name="fix" method="post" action="">
<b>Alla fält är obligatoriska. Registrera endast ett konto/person. Falska personuppgifter leder till borttagning och uteslutning ur våra cuper.</b><br>
<b>När du blir medlem i ACEIT accepterar du att vi lagrar din ip-adress för vidare bruk.</b><br>
<table cellpadding="0" width="100%" cellspacing="0">
<tr><td valign="top" width="30%"><b>Förnamn</b></td><td width="70%" valign="top"><input size="25" type="text" name="fornamn"></td></tr>
<tr><td valign="top" width="30%"><b>Efternamn</b></td><td width="70%" valign="top"><input size="25" type="text" name="efternamn"></td></tr>
<tr><td valign="top" width="30%"><b>Personnr</b></td><td width="70%" valign="top"><input size="25" type="text" name="personnr">  (XXXXXX-XXXX)</td></tr>
<tr><td valign="top" width="30%"><b>Kön</b></td><td width="70%" valign="top"><select name="kon"><option>Man</option><option>Kvinna</option></select></td></tr>
<tr><td> </td><td></td></tr>
<tr><td valign="top" width="30%"><b>Adress</b></td><td width="70%" valign="top"><input size="25" type="text" name="adress"> (Aceitvägen 1 2tr)</td></tr>
<tr><td valign="top" width="30%"><b>Postnummer</b></td><td width="70%" valign="top"><input size="25" type="text" name="postnr"> (11111)</td></tr>
<tr><td valign="top" width="30%"><b>Postort</b></td><td width="70%" valign="top"><input size="25" type="text" name="postort"></td></tr>
<tr><td valign="top" width="30%"><b>Telefonnummer</b></td><td width="70%" valign="top"><input size="25" type="text" name="telefonnr"> (073-XXXXXXX)</td></tr>
<tr><td> </td><td></td></tr>
<tr><td valign="top" width="30%"><b>Användarnamn</b></td><td width="70%" valign="top"><input size="25" type="text" name="anvandarnamn"></td></tr>
<tr><td valign="top" width="30%"><b>Lösenord</b></td><td width="70%" valign="top"><input size="25" type="text" name="losenord"></td></tr>
<tr><td valign="top" width="30%"><b>Mail</b></td><td width="70%" valign="top"><input size="25" type="text" name="mail"></td></tr>
<tr><td> </td><td></td></tr>
</table>
<table>
<tr><td><input type="checkbox" name="accepterar" value="1"> Jag har läst igenom och accepterar <a href="javascript:popup_stadgar('stadgar.php');">stadgarna</a> och går med i föreningen ACEIT som är ansluten till Sverok.
<br><br></td></tr>
<tr><td> <center> <input type="submit" name="skicka" value="Bli Medlem"></center></td></tr>
</table>
</form>

 

And the settings.php
<?php
$server = "localhost";
$database = "dbname";
$db_user = "user";
$db_pass = "mypw";
$nyheter = "nyheter";
$nkommentarer = "nkommentarer";
$cup = "cup";
$cuplag = "cuplag";
$cupschema = "cupschema";
$anvandare = "anvandare";
$rekrytering = "rekrytering";
$inloggad = "admin";
$kontakta = "kontakta";
$admin = "adminid";
$rang = "adminstatus";
mysql_connect("$server","$db_user","$db_pass") or die ("error connecting");
mysql_select_db("$database") or die ("error selecting database");
?>

 

 

The table for users:

CREATE TABLE `anvandare` (
  `aID` int(10) NOT NULL AUTO_INCREMENT,
  `anvandarnamn` varchar(100) NOT NULL DEFAULT '',
  `losenord` varchar(100) NOT NULL DEFAULT '',
  `fornamn` varchar(100) NOT NULL DEFAULT '',
  `efternamn` varchar(100) NOT NULL DEFAULT '',
  `personnr` varchar(100) NOT NULL DEFAULT '',
  `kon` varchar(100) NOT NULL DEFAULT '',
  `adress` varchar(100) NOT NULL DEFAULT '',
  `postnr` varchar(100) NOT NULL DEFAULT '',
  `postort` varchar(100) NOT NULL DEFAULT '',
  `telefonnr` varchar(100) NOT NULL DEFAULT '',
  `mail` varchar(100) NOT NULL DEFAULT '',
  `rang` int(1) NOT NULL DEFAULT '1',
  `status` varchar(100) NOT NULL DEFAULT '',
  `accepterar` int(1) NOT NULL DEFAULT '0',
  `bild` varchar(100) NOT NULL DEFAULT '',
  `online` int(1) NOT NULL,
  `inloggad` datetime NOT NULL,
  `medlemsen` varchar(100) NOT NULL,
  PRIMARY KEY (`aID`),
  UNIQUE KEY `anvandarnamn` (`anvandarnamn`),
  UNIQUE KEY `personnr` (`personnr`)
) ENGINE=MyISAM AUTO_INCREMENT=219 DEFAULT CHARSET=latin1;

 

 

 

Hmm... anyone?

 

Thanks in advance.

 

 

Take care,

/k :wtf::confused:

You probably have an auto increment value in your table and if you don't list the fields it uses all fields including the auto increment. You'll need to specify your fields.

mysql_query("insert into $rekrytering(field1,field2,field3) values ('" . $recruit . "', '" . $nyttidn . "', '" . $datum . "')")

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.