Results 1 to 4 of 4

Thread: Losing Value of Variable

  1. #1
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default Losing Value of Variable

    Line 1 here displays the correct file names, at line 7 the values are lost, the count is correct though. Does anyone know why this would occur?

    PHP Code:
    echo $file2;
    if (!isset(
    $n)) {
        
    $n 0;
    } else {
        
    $n count($helmets);
    }
    echo 
    $files2 $n;
    $helmets[$n] = $files2
    Last edited by bluewalrus; 11-08-2010 at 04:20 AM.
    Corrections to my coding/thoughts welcome.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Take a look:
    Code:
    echo $file2;
    if (!isset($n)) {
        $n = 0;
    } else {
        $n = count($helmets);
    }
    echo $files2 . $n;
    $helmets[$n] = $files2;
    Jeremy | jfein.net

  3. The Following User Says Thank You to Nile For This Useful Post:

    bluewalrus (11-08-2010)

  4. #3
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    OO hah thanks. I thought I was missing something simple there.
    Corrections to my coding/thoughts welcome.

  5. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    No problem! It's the simplest mistakes that make you wonder the most. Please set the status of this thread to "Resolved"
    Jeremy | jfein.net

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
  •