I have problem to set my array value with query result. I have document table with ID_ATTACHMENT as primary key autoincreament, ID_TRANSACTION, DOCUMENT_NAME, NO_DOCUMENT, REMARKS, NAMA_FILE
$queryattacth = mysql_query("SELECT * FROM document A WHERE A.ID_TRANSACTION='13' ");
$tempAttc = array();
for ($i=1;$i<=15;$i++)
{
for ($j=0;$j<5;$j++)
$tempAttc[$i][$j]="";
}
while ($dataattach = mysql_fetch_array($queryattacth)){
if (strtoupper($dataattach['DOCUMENT_NAME'])=='A')
{
$tempAttc[1][2]=$dataattach['NO_DOCUMENT'];
$tempAttc[1][3]=$dataattach['REMARKS'];
$tempAttc[1][4]=$dataattach['NAMA_FILE'];
}
else if (strtoupper($dataattach['DOCUMENT_NAME'])=='B'){
$tempAttc[2][2]=$dataattach['NO_DOCUMENT'];
$tempAttc[2][3]=$dataattach['REMARKS'];
$tempAttc[2][4]=$dataattach['NAMA_FILE'];
}
else if (strtoupper($dataattach['DOCUMENT_NAME'])=='C'){
$tempAttc[3][2]=$dataattach['NO_DOCUMENT'];
$tempAttc[3][3]=$dataattach['REMARKS'];
$tempAttc[3][4]=$dataattach['NAMA_FILE'];
}
.................
}
The result is doesn't show any value for this variable
$tempAttc[1][2];
$tempAttc[1][3];
$tempAttc[1][4];
but have result for this variable
$tempAttc[2][2];
$tempAttc[2][3];
$tempAttc[2][4];
Anyone can hep me about why this happened?
(strtoupper($dataattach['DOCUMENT_NAME'])=='B')B. Also, you have 2else-iffor the same value,B, so the second will never execute.A.ID_TRANSACTION='13'exists and has a known value, then you could just make the array without having to access the DB, so what problem are you actually solving?