php script --> MSSQL error. Why? See details below
[Tue Mar 04 14:10:00 2008] [error] [client 132.64.4.16] PHP Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid object name 'DeviceView'., SQL state S0002 in SQLExecDirect in /srv/www/htdocs/hu/Proj1/ttb.php on line 7
[Tue Mar 04 14:10:00 2008] [error] [client 132.64.4.16] PHP Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in /srv/www/htdocs/hu/Proj1/ttb.php on line 8
[Tue Mar 04 14:10:00 2008] [error] [client 132.64.4.16] PHP Warning: odbc_free_result(): supplied argument is not a valid ODBC result resource in /srv/www/htdocs/hu/Proj1/ttb.php on line 12
Source:
-- begin odbctest.php---
<?
// connect to DSN MSSQL with a user and password
$connect = odbc_connect("DSNNAME", "miki", "84139") or die ("couldn't connect");
odbc_exec($connect, "use SwitchCenterDB");
//$result = odbc_exec($connect, "SELECT * FROM DeviceView");
$result = odbc_exec($connect, "SELECT address, portalias FROM DeviceView");
while(odbc_fetch_row($result)){
print(odbc_result($result, "address") .
' ' . odbc_result($result, "portalias") . "\n");
}
odbc_free_result($result);
odbc_close($connect);
?>
--- end odbctest.php --
Trending Topics
| You Need A Budget | Feb 10, 2012 |
| The Linux powered LAN Gaming House | Feb 08, 2012 |
| Creating a vDSO: the Colonel's Other Chicken | Feb 06, 2012 |
| Your CMS Is Not Your Web Site | Feb 01, 2012 |
| Casper, the Friendly (and Persistent) Ghost | Jan 31, 2012 |
| Razor-qt 0.4 - Qt based Desktop Environment | Jan 30, 2012 |
- Fun with ethtool
- Parallel Programming with NVIDIA CUDA
- Readers' Choice Awards 2011
- 100% disappointed with the decision to go all digital.
- Linux-Based X Terminals with XDMCP
- Validate an E-Mail Address with PHP, the Right Way
- You Need A Budget
- The Linux powered LAN Gaming House
- Why Python?
- Python for Android
- Employment Posters
3 hours 47 min ago - Sure the best distro is
5 hours 7 min ago - BeOS was the best
7 hours 51 min ago - I use Wireshark on a daily
12 hours 22 min ago - buena información
17 hours 28 min ago - One important "bucket" that I didn't note (désolé si qqun deja d
18 hours 29 min ago - Gnome3 is such a POS. No one
1 day 3 hours ago - Gnome 3 is the biggest POS
1 day 4 hours ago - I didn't knew this thing by
1 day 10 hours ago - Author's reply
1 day 13 hours ago





Try something like this:
$result = mysql_query("SELECT * FROM DeviceView");
while($row = mysql_fetch_array($result))
{
echo $row['address'] . " " . $row['portalias'];
echo "/n";
}