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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.