Hi there!,
Below is my exception of my script for an application for my dept.
The purpose of the script is that, it retrieve series of data which meet a criteria
then put all the data into array and finally to display the content of the array.
The problem which I am facing right now is that when I try to display the content of the array, it will left behind a record/row (e.g let say there should be 3 records/rows, but the script will only display the first two records)
Plz help I'm rushing to meet the due date
Thanks So Much
<?php
$r_no_hm='K 04/01';
$r_chk_aks=mysql_query("SELECT item_ref,jenis,serial,no_hm from butir_hm where parent_no_hm like '$r_no_hm'");
if (mysql_fetch_array($r_chk_aks)) {
$r_row_count=mysql_query("SELECT count(item_ref) as total_row from butir_hm where parent_no_hm like '$r_no_hm'");
//assigned the number of rows from above query to variable $t_row
$t_row=mysql_result($r_row_count,0,"total_row");
echo $t_row;
//fetch data from query and assigned them to array
$myrow_aks=mysql_fetch_array($r_chk_aks);
$i=0;
do
{
$r_jenis_aks[$i]=$myrow_aks["jenis"];
$r_serial_aks[$i]=$myrow_aks["serial"];
$r_no_hm_aks[$i]=$myrow_aks["no_hm"];
$i++;
}while($myrow_aks=mysql_fetch_array($r_chk_aks));
}
else {$no_row1=1;}
//test the number of element in the arrays
$count_r_jenis_aks=count($r_jenis_aks);
$count_r_serial_aks=count($r_serial_aks);
$count_r_no_hm_aks=count($r_no_hm_aks);
//echo the number of element in each array
echo $count_r_jenis_aks;
echo $count_r_serial_aks;
echo $count_r_no_hm_aks;
//displaying data from the arrays
for($j=0;$j<$t_row;$j++) {
echo $r_jenis_aks[$j];
echo $r_serial_aks[$j];
echo $r__no_hm_aks[$j];
}
?>