Newbie Access Database question
Posted: Fri Dec 06, 2002 4:09 pm
Hi,
I have just started working with PHP (have 4 resource books opened simultaneously). I am trying to convert an application that my company wrote in ColdFusion to PHP. The demo database that we distribute is MS Access. I have been trying to run a query on a table, and do the following:
1) get the record count
2) put the results into an array for further processing.
The problem I seem to be having (I think....) is that whichever order I try
(1 followed by 2, or 2 followed by 1) it seems I am only getting valid results for the first step I execute.
I am using the following function to get the recordcount:
function RecordCount ($Query) {
while (odbc_fetch_row($Query)) $rows++;
odbc_fetch_row($Query,0);
return $rows;
}
for the array, I am using:
while(odbc_fetch_row($getuser)) {
$odbcFieldName=odbc_field_name($getuser,1);
$LocalAccountList[$odbcFieldName]=odbc_result($getuser,1);
}
If I do the record count first, I get the correct record count, but then I don't get any results in the array. If I do the array first, I get results in the array, but the record count comes back blank.
Any help would be greatly appreciated as I am starting to lose sleep (and hair) over this.
Regards,
Lisa
I have just started working with PHP (have 4 resource books opened simultaneously). I am trying to convert an application that my company wrote in ColdFusion to PHP. The demo database that we distribute is MS Access. I have been trying to run a query on a table, and do the following:
1) get the record count
2) put the results into an array for further processing.
The problem I seem to be having (I think....) is that whichever order I try
(1 followed by 2, or 2 followed by 1) it seems I am only getting valid results for the first step I execute.
I am using the following function to get the recordcount:
function RecordCount ($Query) {
while (odbc_fetch_row($Query)) $rows++;
odbc_fetch_row($Query,0);
return $rows;
}
for the array, I am using:
while(odbc_fetch_row($getuser)) {
$odbcFieldName=odbc_field_name($getuser,1);
$LocalAccountList[$odbcFieldName]=odbc_result($getuser,1);
}
If I do the record count first, I get the correct record count, but then I don't get any results in the array. If I do the array first, I get results in the array, but the record count comes back blank.
Any help would be greatly appreciated as I am starting to lose sleep (and hair) over this.
Regards,
Lisa