Thank you very much sir but the error is still the same...
I also forgot that these scripts are inside of a FOR loop
example:
for($i=0;$i<=$days;$i++){
$rsHR = array();
$rsHR = getHRremarks($todayTime, $deptEE['fldUserID']);
foreach ($rsHR as $idRem=>$hrremark){
$remark[] = $hrremark['remark_name'];
$GLOBALS['rem_name'] = implode(",", $remark);
$remark_code[] = $hrremark['remark_code'];
$GLOBALS['rem_code'] = implode(",", $remark_code);
}
}
The the function for the getHRremarks is :
function getHRremarks($today, $employee){
mysql_connect('localhost', 'root', '') or die(mysql_error());
mysql_select_db('actatek_test') or die(mysql_error());
//r.remark_code
$qry = "SELECT DISTINCT r.remark_name
FROM actatek_hrremarks r
INNER JOIN actatek_applied_remarks ar
ON r.remark_id = ar.remark_id
WHERE ar.userID = '$employee'
AND ar.startDate = '$today'
";
$result = mysql_query($qry);
//$rowCount = mysql_num_rows($result);
if($result){
for($i=0;$i<mysql_num_rows($result);$i++){
if (mysql_num_rows($result) == 0){
$rs = null;
}
else{
$rs[] = mysql_fetch_array($result);
}
}
return $rs;
}
}
Scenario:
where:
$days = 4 in the FOR loop
$todayTime = date no.1 until date no. 4 (nov 17-20 2006)
$deptEE['fldUserID'] = employee number
1.) In a 4 record query, in the MYSql database, the loop function will try to search the r.remark_name for 4 records simultaneously and the result are only 3 records. because the first date (nov 17, 2006) doesn't have a HRremark.
//if I do print_r($remark) the result is this:
Array ( [0] => VL - am )
Array ( [0] => VL - am [1] => VL - am )
Array ( [0] => VL - am [1] => VL - am [2] => SL - pm )
which I think is correct... because the first result is VL-am, then VL-am and SL-pm.
Question:
what code can I use to return an array with a (NULL or 0, VL-am, VL-am, SL-pm) ?
I really hope you can help me with this... and I thank you very much for your support.
Grace