How do you save rows to an array and print out in PHP using ODBC?

Posted by johnny on Stack Overflow See other posts from Stack Overflow or by johnny
Published on 2010-04-01T20:18:24Z Indexed on 2010/04/01 20:23 UTC
Read the original article Hit count: 340

Filed under:
|

I have the following:

while($myRow = odbc_fetch_array( $result )){ <--lots of rows
    $thisResult['name'] = $myRow["name"] ;
    $thisResult['race'] = $myRow["race"] ;
    $thisResult['sex'] = $myRow["sex"];
    $thisResult['dob'] = $myRow["dob"];
}

I can't figure out how to print this back out.

I want to get each row and iterate through each row in the array like a datareader. I'm not sure what to do. I do not want to do the echo in the while. I need to be able to print it out elsewhere. But I don't think I've done it right here to be able to print it later.

I also tried, this, however:

while($myRow = odbc_fetch_array( $result )){ <--lots of rows
     print($thisResult[$myRow["name"]] = $myRow);
}

I then tried:

while($myRow = odbc_fetch_array( $result )){ <--lots of rows
    print (odbc_result($myRow,"name"));
}

but got an error.

Thank you for any help.

© Stack Overflow or respective owner

Related posts about php

Related posts about odbc