TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   an error makes me crazy nuts !!!!!!! (http://www.talkphp.com/absolute-beginners/2351-error-makes-me-crazy-nuts.html)

webtuto 02-27-2008 09:23 AM

an error makes me crazy nuts !!!!!!!
 
hey
im working on a website but i get this error
and the issue is that the same code is used on many pages but the error is just on 2 pages

here is the code

PHP Code:

require("config.inc");
include(
"function.inc");
dbconn($db_host,$db_name,$db_user,$db_pass); 

and here is the error =>

PHP Code:

Fatal errorCannot redeclare dbconn() (previously declared in C:\wamp\www\alfars\controls\function.inc:2in C:\wamp\www\alfars\controls\function.inc on line 12 

looking forward forthe answer

maZtah 02-27-2008 10:31 AM

You're double trying to make a connection to the database.

A proper solution would be to make the connection in the config.inc file.
In that case, put this in your config.inc file:

PHP Code:

mysql_connect("localhost""user""pwd") or die(mysql_error());
mysql_select_db("db") or die(mysql_error()); 

You can delete the dbconn line now. Every time you include your config file it connects to the database automaticly.

Hope this is what you want though :).


All times are GMT. The time now is 09:43 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0