我有一个问题,试图爆炸一个数组,连接到数据库工作和测试,注释打印行工作,但爆炸不,每次我爆炸的项目它
打印ArrayArrayAray。我在这个问题上纠结了很长时间,找遍了所有地方,效仿了一些例子,但都无济于事。如果有人能帮忙,我将不胜感激。
$result_ = mysql_query("SELECT * FROM " .PRODUCT_INSTRUCTIONS. " order by group_code") or
die($errorhandler->add("ERROR", __FILE__ . "=>" . __CLASS__ . "=>" . __FUNCTION__ . "=>" . __LINE__, "Failed getting items." . mysql_error()));
while($rows_= mysql_fetch_array($result_)){
$instruction = $rows_['instructions'];
// print "<tr><td>".$rows_['group_code']."</td></tr>"." <tr><th>".$instruction."</th></tr>";
$inst = explode("|", $instruction);
for($i = 0; $i < count($inst); $i++){
echo $inst;
}
}
?>
添加索引到echo
命令
for($i = 0; $i < count($inst); $i++){
echo $inst[$i];
}
for($i = 0; $i < count($inst); $i++)
{
//If $inst is an array it will print the array else it print as string
if(is_array($inst))
print_r($inst);
else
echo $inst;
}
如果要打印数组,请使用var_dump()
。
$instruction = $rows('instructions');
// print "<tr><td>".$rows_['group_code']."</td></tr>"." <tr><th>".$instruction."</th></tr>";
$inst = explode("|", $instruction);
for($i = 0; $i < count($inst); $i++){
echo $inst[$i];
}
replace
echo $inst;
print_r($inst);