Raconteur Posted April 30, 2007 Share Posted April 30, 2007 Hi gang, This is driving me nuts, and I am hoping SOMEONE can shed some light on it. I am getting a "Cannot redeclare..." error whenever I reload a page. The page runs fine the first time through, but if I hit the Refresh/Reload button, I get the error. Files are very simple. I have test.php, which has an require_once "DBI.php" in it. The DBI.php connects to a MSSQL table, and defines a function, getColumns($table). The function is nothing more that a query string and a call to MSSQL_QUERY, and a return $result. Actually... here is the code for both files: test.php require_once "DBI.php"; $table = "test"; $cols = getColumns($table); DBI.php $conn = MSSQL_CONNECT("localhost", "<username>", "<password>"); if (!$conn) { echo "NO CONNECTION!"; die; } else { MSSQL_SELECT_DB("Northwind", $conn); } function getColumns($table) { $sql = "SELECT column_name FROM information_schema.columns WHERE table_name = '$table'"; $result = MSSQL_QUERY($sql); return $result; } I load the page, everything looks good, but if I hit refresh, the error gets thrown. Could this be a .INI file issue? Or am I missing something? Interestingly, if I issue an iisreset from the command line, the error goes away, until I refresh. I am running WinXP Pro, IE7, PHP5.2.1 and SQL Server 2K. Thanks for any help! Chris Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.