Following is my code; i didnot get problem what's wrong with it;
$units=explode(";",$course->unitinfo);
foreach($units as $unit)
{
$unitinfo=explode("|",$unit);
echo'<tr>
<td>'.$unitinfo[1].'</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>';
}
Here string $course->unitinfo comes with two delimiters first is ; and contains info of one row and second delimiter is | pipe sign; first explode works fine; second explode generates error with undefined offset, if print it with print_r is shows-
Array
(
[0] => 1
[1] => Mechanics
[2] => 5
[3] => 1,2
[4] => 3,1
)
and the problem is cant access via its index - $unitinfo[1]; where i am wrong
var_dump($unit, $unitinfo);