implode()胶水不能正常工作PHP

时间:2017-11-22 17:49:49

标签: php

代码的预期行为是

  

动态地为数组赋值(这样做几次)然后打印它

代码:

$PLLinks = array();

$sql245 = "SELECT `Username`, `Password`, `MacAddress` FROM `Users` WHERE `Username` LIKE '$guestUsername' AND `Password` LIKE '$guestPassword' AND `MacAddress` LIKE '$guestMacAddress'";
$result4 = mysql_query($sql245);
if (mysql_num_rows($result4) == 1) {


for ($i = 0; $i<count($Checknames); $i++)
{   

    if ($PLNames[$i] == 'Valid' && $PLChecked[$i] == 'Invalid'){

    $result = mysql_query("SELECT `Link` FROM `Checksums` WHERE `Name`       LIKE '$ValidNames[$i]' LIMIT 1");

    $value = mysql_fetch_object($result);
    $PLChecked[] = $value->{'Link'};
    echo $value->{'Link'};


    }
    else if ($PLNames[$i] == 'Valid' && $PLChecked[$i] != 'Invalid') {

        $PLLinks[] = 'noUpd';
    }
    else if ($PLNames[$i] != 'Valid') {

        $PLLinks[] = 'Remove';
    }
}


echo implode(',', $PLLinks); 
    // this should print "a,b,c" but instead it prints "abc"
}

如果解决方案很简单,请仅提示

感谢

0 个答案:

没有答案