very simple problem

Ok so I am new to php and am having a problem with a simple script that I have seen work from a php learning video tutorial (made in 2002). I will include the codes I have been trying to get to work. Basically I wanna connect to a mysql database but with 2 separate files. One file db_config.php has the login information. bikes.php has the strings to start the connection.


<?php require ($_SERVER["DOCUMENT_ROOT"].'/bikes/db_config.php'); $connection = mysql_connect ($db_host, $db_user, $db_password) or die ("error connecting"); echo "connection made"; ?>


<?php $db_host = "localhost"; Sdb_user = "admindb"; $db_password = "*****"; $db_name = "bikes"; ?>

I took the liberty of removing your password for security reasons.

To assess your problem: are you getting any errors? If not, have you tried using error_reporting(E_ALL); on top of your script to make sure any and all errors are displayed? See also the link in my signature for debugging tips and tricks.

Sponsor our Newsletter | Privacy Policy | Terms of Service