- Code: Select all
<?php
require($_server["document_root"]."/config/db_config.php");
$connection = mysql_connect($bd_host, $db_user, $db_password) or die("error connecting");
echo "connection made";
?>
Thats my code and i'm trying to use an external php file with the connection info to connect to mysql. the folder config exists within the htdocs folder but i get this error msg
Warning: main(/config/db_config.php) [function.main]: failed to open stream: No such file or directory in C:\apachefriends\xampp\htdocs\test2.php on line 2
Fatal error: main() [function.require]: Failed opening required '/config/db_config.php' (include_path='.;c:\apachefriends\xampp\php\pear\') in C:\apachefriends\xampp\htdocs\test2.php on line 2
plz help.is it my code or do i need to know something more about xampp.