foreach loop not returning values from $

I have set a $_SESSION variable and cannot see why my foreach loop is not working. All I get if I echo the var $v is a white screen. If I echo my session var then I can see the data that is being passed is in the format wd10,wd11,wd12.

I would be grateful if someone could check my loop and point out my mistake. Thanks

I have session_start() at the top of the page and all sessions and mysql queries are working normally.

<?php
    foreach ($_SESSION['boxdest2'] as $key=>$value)
        {   
      $temp = explode(",", $value);
      foreach($temp as $k => $v )
      {
        $query = "SELECT * FROM boxes WHERE customer = '$_SESSION[kt_idcode_usr]' AND status = 1 AND custref = '$v'";
        $result = mysql_query($query) or die(mysql_error());
        $row = mysql_fetch_array($result) or die(mysql_error());
        $rack = $row['rack'] . "-" . $row['column'] . "-" . $row['row'] .  "-" . "(" . $row['bay'] . ")";

    //    $query = "UPDATE boxes SET status = '9' WHERE customer = '$customer' AND department = '$dept' AND custref = '$v'";
    //    mysql_query($query) or die('Error, query failed');
    //  
        $query = 'INSERT INTO `act` (`slot`, `service`, `activity`, `department`, `company`, `address`, `user`, `item`, `destroyedby`, `destroyedby_date`, `date`, `new`) VALUES (''.$rack.'', ''.$service.'', ''.$activitys.'', ''.$dept.'', ''.$company.'', ''.$address.'', ''.$user.'', ''.$v.'', ''.$user.'',NOW(),NOW(), ''.$new.'');';
       mysql_query($query) or die('Error, query failed');
        }
        }
?>
链接地址: http://www.djcxy.com/p/59740.html

上一篇: 在XCode for Simulator中编译的内联asm,但无法编译为Device

下一篇: foreach循环不会从$返回值