Dear all
I'm putting together a small app in flash for an e-learning site, part of which pulls a random row from an Access DB and displays the fields in succession. To put it another way, each time the user logs in to the page, they get a different set of textlets to look at: study tips, weird and wonderful facts, and the like.
I'm getting an 'invalid odbc resource' message from the browser during trialling for reasons I can't fathom in the 2 lines marked **:
$odbc_rs = @odbc_do($odbc_db, $query);
if ($odbc_rs == false) {
echo "error executing query";
exit;
}else{
//generate random choice of row by first finding number of rows
$num_of_rows = 1;
while (odbc_fetch_row($odbc_rs)){
$num_of_rows++;}
//and then taking a random choice from there
$random = rand(1,$num_of_rows-1);
$result = odbc_fetch_row($odbc_rs,$random);
//go through the row, and output to Flash only those fields which are not null
$output = "";
$count = 1;
$didYouKnow = odbc_result($result, $count);
while (odbc_result($result, $count) != "") {
$output .= "&dyntext" . $count . "=" . ($didYouKnow);
$count++;
Looks well formed to me, but the parser says otherwise. Any ideas on why these two lines won't work and what possibly would, would really make my week.
Cheers, Al