SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Nov 2009
    Posts
    471
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can someone tell me what's wrong with this code

    Can someone tell me what's wrong with this code please

    while ($lookrowinit = mysqli_fetch_array($qr_result))
    {
    if ($lookrowinit['looktype'] == 'fieldname' && $lookrowinit['value'] != 'NA')
    {
    $_SESSION['fields'] = array(
    'value' => $lookrowinit['value'],
    'description' => $lookrowinit['description']);
    $a++;
    }
    elseif ($lookrowinit['value'] != 'NA')
    {
    $_SESSION['lookrow'] = array(
    'lookupid' => $lookrowinit['lookupid'],
    'looktype' => $lookrowinit['looktype'],
    'value' => $lookrowinit['value']);
    $b++;
    }
    }

    $_SESSION['numfields'] = count($_SESSION['fields']);
    $_SESSION['passvar']['numrecs'] = count($_SESSION['lookrow']);

    When I process it, $a = 8, $b = 45, $_SESSION['numfields'] = 2, $_SESSION['passvar']['numrecs'] = 3

  2. #2
    SitePoint Evangelist
    Join Date
    Nov 2009
    Posts
    471
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Evidently you can't assign an array dynamically to a session variable?

    If I create the arrays 'fields' and 'lookrow' into regular variables and then set the session variables equal to them, and then do the count of the session variables, it works.


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
  •