SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Column count doesn't match value count

    This keeps erroring, inserting only on the first table 'MemP', not the second- 'Signup'

    Default - Post to Signup table, not successful:

    Column count doesn't match value count at row 1
    1136
    PHP Code:
    /* 1st check for duplicate in column MP_t, to prevent dupkicate inserts: 
    note this is working*/
    $dupequery "select MP_t from MemP where MP_t='".$MPt."'";
    $dupecheck mysql_query($dupequery) or die("Duplicate transid check failed:<br>" mysql_error() . "<br>" mysql_errno());
    $num mysql_num_rows($dupecheck);
    if (
    $num == 0){ 
    /*this table is inserting correctly */
         
    if($MPs== "AP"){$first "insert into MemP(MID,MSID,MP_t)values('".$Mid."','".$Msid."','".$MPt."')";
    $result mysql_query($first)or die("Post to MemP table, not successful:<br>" mysql_error() . "<br>" mysql_errno());
    }
    /* not inserting here:*/ 
    if(($MPs== "AP")&&($MPp!=='BB')){$second "insert into Signup(SID,Sp,Spid)values('".$Mid."','".$MPp."',".$MPt."')";
    $result mysql_query($second)or die("Post to Signup table, not successful:<br>" mysql_error() . "<br>" mysql_errno()); 
    have tried adding the auto increment row id as:
    ('',SID,Sp,Spid)values('"",".$Mid."','".$MPp."','".$MPt."')";

    without a difference. suggestions?

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    MemP(MID,MSID,MP_t)values('".$Mid."','".$Msid." ,'".$MPt."')"; 
    What's with the in between $Msid and $MPt?

  3. #3
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    please have another look.

    also:

    http://htmlfixit.com/cgi-tutes/tutor...alue_Count.php

    but this seems to not make a difference.

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I didn't even know the DB could read queries without any spaces between words. You still had some strange backticks in there, try it with just single quotes:

    PHP Code:
    $second "INSERT INTO Signup (SID, Sp, Spid) VALUES ('" $Mid "', '" $MPp "', '" $MPt "')"

  5. #5
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, nevermind, the issue is you don't have a space between spid) and values.

  6. #6
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dan, Chris,

    thank you much! it was the spaces.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •