Jump to content

Non-standard "Cannot Redeclare..." error


Raconteur

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/49361-non-standard-cannot-redeclare-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.