...

View Full Version : Database Connectin with an Include



kenwvs
08-16-2006, 11:28 PM
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:


<?php
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


<?php

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

//CONFIGURATION SECTION STARTS ///

$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

// CONFIGURATION SECTION ENDS ////



mysql_connect($servername,$database_username,$database_password);
mysql_select_db($database_name)or die(mysql_error());
?>

Len Whistler
08-17-2006, 05: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.


<?php
include "db_connect.php";
?>
db_connect.php


<?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);
?>

kenwvs
08-17-2006, 05: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?

Ken

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum