View Full Version : Database Connectin with an Include

08-17-2006, 12:28 AM
I have used the following statement to connect to my database, and when I run a debug I am getting the following error:

Fatal Error: Call to undefined function mysql_connect() in c:/www.....

This is how it shows in the various files:

include_once "myconnect.php";
/* WorkOrder.php */

The wierd thing is that even though I get the fatal error, the connection to the database still works and the data is uploaded to the database.

I am getting this error on every screen that has this include.

Here is the info in the file myconnect.php


// YOU NEED TO CHANGE THE CONTENTS OF THE values of variables given in single quotes


$servername='localhost' ; // Replace this 'localhost' with your server name
$database_username='root'; // Replace this with your username
$database_password=''; // Replace this with your password
$database_name='ge'; // Replace this 'db' with your database name


mysql_select_db($database_name)or die(mysql_error());

Len Whistler
08-17-2006, 06:36 AM
I got that error message when I installed phorum 5.1.15 with PHP 4.2.3, the forum required PHP 4.3 or higher. Below is the db connect code I use, one improvement would be to move the db_connect.php out of the route directory.

include "db_connect.php";

define ('DB_USER', '');
define ('DB_PASSWORD', '');
define ('DB_HOST', 'localhost');
define ('DB_NAME', 'store');

$dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD);
mysql_select_db (DB_NAME);

08-17-2006, 06:00 PM
Thanks for the tip, I will have to see if I can figure out what isn't working together......

What do you mean by move it out of the route directory, and why do you suggest that? Is this a security issue?


11-22-2006, 10:02 AM
anybody knows name of that script? ^^ ?