Using a ODBC driver to connect to a database.
Connection works ok:
$db = odbc_connect( 'database','username','password');
View all tables in database works ok:
$result = odbc_tables($db);
$tables = array();
while (odbc_fetch_row($result))
{
if(odbc_result($result,"TABLE_TYPE")=="TABLE")
echo"<br>".odbc_result($result,"TABLE_NAME");
}
View all columns in table works ok:
$result = odbc_columns($db, "database", "", "table_name", "%");
while (odbc_fetch_row($result)) {
echo odbc_result_all($result);
}
However, when I try to make a query of my own it complains about the table name.
$result = odbc_exec($db, "SELECT * FROM table_name");
Warning: odbc_exec() [function.odbc-exec]: SQL error: [IBM][CLI Driver][DB2/AIX64] SQL0204N "username.table_name" is an undefined name. SQLSTATE=42704 , SQL state S0002
Anyone encountered this problem before? My only theory is that it's looking for username.table_name instead of table_name...