#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    230
    Rep Power
    96

    One column of data not being inserted?


    PHP Code:
    // Create short year span xx-xx
    for ($i 0$i $DaystarDCIImportCount$i++) {
        if (
    $DaystarDCIImport[$i]['VehicleYearStart'] == "May 2013") {$StartYear "5/13";}
        elseif (
    $DaystarDCIImport[$i]['VehicleYearStart'] == "Jul 1995") {$StartYear "7/95";}
        elseif (
    $DaystarDCIImport[$i]['VehicleYearStart'] == "Feb 1979") {$StartYear "2/79";}
        else {
    $StartYear substr($DaystarDCIImport[$i]['VehicleYearStart'], -2);}
        if (
    $DaystarDCIImport[$i]['VehicleYearEnd'] == "Apr 2013") {$EndYear "4/13";}
        elseif (
    $DaystarDCIImport[$i]['VehicleYearEnd'] == "Oct 1984") {$EndYear "10/84";}
        elseif (
    $DaystarDCIImport[$i]['VehicleYearEnd'] == "Jun 1988") {$EndYear "6/88";}
        else {
    $EndYear substr($DaystarDCIImport[$i]['VehicleYearEnd'], -2);}
        
    $DaystarDCIImport[$i]['VehicleYears'] = $StartYear."-".$EndYear;

    I get the correct values in my resulting array:
    [30] => Array
    (
    [PartNo] => KC09100BK
    ...
    [VehicleYearStart] => 2011
    [VehicleYearEnd] => Apr 2013
    ...
    [VehicleYears] => 11-4/13
    )
    But the VehicleYear column CHAR(20) is NULL once the whole array is inserted. The rest of the data is inserted correctly.

    Thoughts?
  2. #2
  3. Wiser? Not exactly.
    Devshed God 2nd Plane (6000 - 6499 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    6,079
    Rep Power
    4101
    Sounds like a variable name typo. Perhaps an extra or missing s on VehicleYears?
    Recycle your old CD's



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    230
    Rep Power
    96
    That would throw some kind of unknown variable or invalid column error, no? In any event, no typo. It matches everywhere it's at...

    vehicle years.png
  6. #4
  7. Wiser? Not exactly.
    Devshed God 2nd Plane (6000 - 6499 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    6,079
    Rep Power
    4101
    Originally Posted by big0mike
    That would throw some kind of unknown variable or invalid column error, no?
    If your error reporting is configured as such, yes. It's an E_NOTICE level error so many configurations ignore it.

    You're using $i rather than $j as your loop variable for that line.
    Recycle your old CD's



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    230
    Rep Power
    96
    They are two separate loops. $i is used in the conversion. $j is used in the SQL query that inserts the data.
  10. #6
  11. Wiser? Not exactly.
    Devshed God 2nd Plane (6000 - 6499 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    6,079
    Rep Power
    4101
    Originally Posted by big0mike
    $j is used in the SQL query that inserts the data.
    Except on that one line.
    Recycle your old CD's



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    230
    Rep Power
    96
    Shhhhiiiiiit...

IMN logo majestic logo threadwatch logo seochat tools logo