Ok, I have an affiliate bar set up, that Dwight coded for me, but when things changed the affiliate bar stopped working. Dwight is unable to help right now, so I'm stuck with it not working. This is the error I get inside the affiliate bar:
Fatal error: Cannot redeclare class Database in /home/idirect/public_html/includes/Database.class.php on line 35
Now when I take out /home/idirect/public_html in the line above, it shows the affiliates, but with a set of whole new errors:
[31-Mar-2011 10:37:55] PHP Warning: include() [<a href='function.include'>function.include</a>]: Failed opening '/includes/Database.class.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/idirect/public_html/incl udes/global.php on line 30
[31-Mar-2011 10:37:56] PHP Warning: include(/includes/Database.class.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/idirect/public_html/incl udes/global.php on line 30
I'm not quite sure what to do.
http://idirectory.us
If you need the files I can send them in PM.
Thanks
For other softwares like drupal/wordpress. This means the functions file went missing.
Ok, I have an affiliate bar set up, that Dwight coded for me, but when things changed the affiliate bar stopped working. Dwight is unable to help right now, so I'm stuck with it not working. This is the error I get inside the affiliate bar:
Fatal error: Cannot redeclare class Database in /home/idirect/public_html/includes/Database.class.php on line 35
Now when I take out /home/idirect/public_html in the line above, it shows the affiliates, but with a set of whole new errors:
[31-Mar-2011 10:37:55] PHP Warning: include() [<a href='function.include'>function.include</a>]: Failed opening '/includes/Database.class.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/idirect/public_html/incl udes/global.php on line 30
[31-Mar-2011 10:37:56] PHP Warning: include(/includes/Database.class.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/idirect/public_html/incl udes/global.php on line 30
I'm not quite sure what to do.
http://idirectory.us
If you need the files I can send them in PM.
Thanks
The line I bolded in the quote above explains what the error is. Line 35 in Database.class.php is trying to declare a class that's already been declared somewhere else before. If Database.class.php is a file that came with a pre-built CMS (like Joomla or Wordpress), then their support is probably the best place to go as it's a problem with their system.
However, if Database.class.php is a file you (or Dwight) created, then you simply need to find where the class is first declared, make sure that deleting the class on line 35 won't break things, and then go ahead and delete the duplicate.
Line 35 is just class Database {
and below it is
var $server = ""; //database server
var $user = ""; //database login name
var $pass = ""; //database login password
var $database = ""; //database name
var $pre = ""; //table prefix
and I nor did Dwight create it. I have no clue what to do. Everything pretty much depends on the Database. I don't know what joomla is, but I don't have either joomla or Wordpress..
Line 35 is just class Database {
and below it is
var $server = ""; //database server
var $user = ""; //database login name
var $pass = ""; //database login password
var $database = ""; //database name
var $pre = ""; //table prefix
and I nor did Dwight create it. I have no clue what to do. Everything pretty much depends on the Database. I don't know what joomla is, but I don't have either joomla or Wordpress..
As I said, "class Database" is defined somewhere else already, which is why the site is throwing errors (you can't have multiple classes with one name, or one class defined numerous times). Joomla and Wordpess are examples of Content Management Systems (CMS); if you use a Content Management System for your website, then their support can likely help better than we can.
Whereabouts did you get the backend for your website?
I see. And Dwight. Our coding is 80% the same I do believe On his and mine, basically copy/paste for him, but he's not in the mood to look into it, and im not gonna push it. I'll have a look in my files later and post back here. As I am not quite sure where to go or what to do.
I see. And Dwight. Our coding is 80% the same I do believe On his and mine, basically copy/paste for him, but he's not in the mood to look into it, and im not gonna push it. I'll have a look in my files later and post back here. As I am not quite sure where to go or what to do.
I feel like the most likely thing that happened is that you include()'d or require()'d the file twice on the same page; the best thing to do is to find all the instances of the database class and replace the include() or the require() (whichever function you're using) with include_once() or require_once(), respectively. These functions check to see if the file has already been included, and only includes it if it hasn't.
In my global.php which is included onto most pages it has this, the only ones that dont have this are the categorires. but they do have
<?php
$name = 'Role Play';
include ("./includes/category_core.php");
?>
and this is in the global.php
include("/home/idirect/public_html/includes/Database.class.php");
?>
with out that, it wont work.
But in the 700wideF.php it has this.
<?php
include_once('/home/idirect/public_html/includes/Database.class.php');
include_once('/home/idirect/public_html/includes/global.php');
$db = new Database($DBhost, $DBuser, $DBpass, $DBname, $DBpre);
$db->connect();
$rand_item = mysql_query("SELECT * FROM ads") or die(mysql_error());
echo "<marquee onmouseover=\"this.stop()\" onmouseout=\"this.start()\">";
while($row = mysql_fetch_assoc($rand_item)) {
echo "<a href=\"$row[url]\" target=\"_blank\" /><img src=\"$row[image]\" border=\"0\" ></a> ";
}
echo "</marquee>";
$db->close();
?>
Try changing the include() in global.php to include_once() and see if that works.
That worked! Thanks!
That worked! Thanks!
No worries.
PHP or any coding can be so difficult. x.x Thanks again.