I am running Apache2 for Windows, PHP 5.3.0 and have an Access database set up as a system DSN. I am able to send INSERTS, SELECTS, and other standard queries via ODBC, but the specific commands that do not work are any that might be useful in extracting multiple rows of data from the database. I can't figure out what is going on and I am really frustrated. The following commands do not work:
odbc_fetch_row
odbc_num_rows
odbc_fetch_array
odbc_num_fields
please note: I have no trouble with gaining access to the Database and submitting odbc_exec commands.
function createMenu($table,$value=NULL){
$query="SELECT * FROM $table";
$db_link=openDatabase();
$result=odbc_exec($db_link,$query)or die(print odbc_errormsg());
$count=recordCount($result); //this was a workaround bc odbc_num_rows() always returns -1
$html[]="<select name='$table' id='$table'>";
if($count>0){
while(odbc_fetch_row($result)){
$type_name=odbc_result($result,'type_name');
$abbr=odbc_result($result,'abbr');
$selected="";
if($value==$abbr){
$selected="selected";
}
$html[]="<option value='$abbr' $selected>$type_name</option>";
}
$html[]="</select>";
$output=join("\n",$html);
print $output;
}
odbc_close($db_link);
}
I'd love to be able to use a LAMP setup, but the project I am working on requires an mdb data source and must run on Windows.
Thanks for any help!