Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Cannot redeclare class
Old 12-18-2008, 02:20 PM Cannot redeclare class
Sharkness's Avatar
Novice Talker

Posts: 13
Name: Mike M
Trades: 0
Quote:
Fatal error: Cannot redeclare class DB in C:\***\htdocs\smile\admin\function.php on line 5

so this is functions line 5 is class DB{
Code:
<?php 

require('vars.php');

class DB{
	
	function query($query){
		mysql_connect($mysqllocation,$mysqlusername,$mysqlpassword) or die('Connection Failed');
		mysql_select_db($mysqldatabase) or die("Unable to select database");
		mysql_query($query) or die('Query Error');
		mysql_close();
	}
	
	function row($query){
		$connect = mysql_connect($mysqllocation,$mysqlusername,$mysqlpassword);
		mysql_select_db($mysqldatabase, $connect);
		$result = mysql_query($query) or die(mysql_error());
		$row = mysql_fetch_array($result) or die(mysql_error());
		return $row;
	}
}


?>
I tried include_once vars in the functions itself and include vars in the function...

Now I've seen people using public vars... I don't get by the way... so am I calling my vars wrong because their just strings containing mysql data?


From what I understand using require halts the script causing a fatal error?
But when I comment it out I still get a fatal error.
Sharkness is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-18-2008, 03:03 PM Re: Cannot redeclare class
Sharkness's Avatar
Novice Talker

Posts: 13
Name: Mike M
Trades: 0
My own fault I was using require instead of require once to pull the functions.
Sharkness is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Cannot redeclare class
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10473 seconds with 12 queries