So I am trying to perform what is quite a simple action: query a single table, two attribute Access database and just display the results, but something about my code stops it in its tracks. I've looked at several sources for things that could be wrong but I've run out of things I can think of to change. Here's my code:
<?php
echo "<p>Ostriches</p>";
$DSN="Users.accdb";
$DSN_User="";
$DSN_Passwd="";
$QueryString="SELECT * FROM tblUsers";
$Connect = odbc_connect( $DSN, $DSN_User, $DSN_Passwd );
$Result = odbc_exec( $Connect, $QueryString );
echo "<p>Ostriches</p>";
echo "\t" . "<tr>\n";
echo "\t\t" . "<td>id</td><td>ID</td><td>Type></td>" . "\n";
while( odbc_fetch_row( $Result ) )
{
$id = odbc_result($Result,"id");
$ID = odbc_result($Result,"ID");
$Type = odbc_result($Result,"Type");
echo "\t" . "<tr>\n";
echo "\t\t" . "<td>" . $id . "</td><td>" . $ID . "</td><td>" . $Type . "</td>\n";
echo "\t" . "</tr>\n";
}
odbc_free_result( $Result );
odbc_close( $Connect );
?>
The first and second "Ostriches" is outputted but it never reaches the third one, so I think the error is on lines 11 and 12 but I just can't see what's wrong with it.
Aucun commentaire:
Enregistrer un commentaire