vForums Support Banner



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Programming Discussion :: Needing some help. - View Topic
Topic Rating: *****
Printable View
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 34
Joined:  
Reputation: 62%  


pmwww
Needing some help. (31st Mar 11 at 7:51pm UTC)
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/includes/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/includes/global.php on line 30


I'm not quite sure what to do. {Unsure}


http://idirectory.us

If you need the files I can send them in PM.

Thanks
ashkir
Full Member
***

[Avatar]

Posts: 1,159
Status: Offline
Gender: Male
Location: Cali!
Age: 35
Joined:  
Reputation: 42%  


pmtwitterskypemsnyahoo
Re: Needing some help. (31st Mar 11 at 10:34pm UTC)
For other softwares like drupal/wordpress. This means the functions file went missing.
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: Needing some help. (1st Apr 11 at 2:38pm UTC)
 
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/includes/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/includes/global.php on line 30


I'm not quite sure what to do. {Unsure}


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. {Smile}

rroll.to— Shorten a link, rickroll your friends.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 34
Joined:  
Reputation: 62%  


pmwww
Re: Needing some help. (1st Apr 11 at 7:22pm UTC)
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.. {Tongue Out}

Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: Needing some help. (1st Apr 11 at 11:21pm UTC)
 
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.. {Tongue Out}



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. {Wink}

Whereabouts did you get the backend for your website?

rroll.to— Shorten a link, rickroll your friends.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 34
Joined:  
Reputation: 62%  


pmwww
Re: Needing some help. (2nd Apr 11 at 5:30am UTC)
I see. And Dwight. {Lips Sealed} 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. {Tongue Out} 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. {Lips Sealed}
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: Needing some help. (2nd Apr 11 at 2:52pm UTC)
 
I see. And Dwight. {Lips Sealed} 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. {Tongue Out} 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. {Lips Sealed}


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.

rroll.to— Shorten a link, rickroll your friends.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 34
Joined:  
Reputation: 62%  


pmwww
Re: Needing some help. (2nd Apr 11 at 5:45pm UTC)
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();
?>
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: Needing some help. (3rd Apr 11 at 4:06am UTC)
Try changing the include() in global.php to include_once() and see if that works. {Smile}

rroll.to— Shorten a link, rickroll your friends.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 34
Joined:  
Reputation: 62%  


pmwww
Re: Needing some help. (3rd Apr 11 at 2:57pm UTC)
{Grin} That worked! Thanks! Smiley
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: Needing some help. (3rd Apr 11 at 11:56pm UTC)
 
{Grin} That worked! Thanks! Smiley


No worries. {Smile}

rroll.to— Shorten a link, rickroll your friends.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 34
Joined:  
Reputation: 62%  


pmwww
Re: Needing some help. (4th Apr 11 at 4:49am UTC)
PHP or any coding can be so difficult. x.x Thanks again. {Smile}
 Printable View

All times are GMT+0 :: The current time is 12:33am
Page generated in 4.3288 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums