Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dropping mysql connection with php

Status
Not open for further replies.

Bastien

Programmer
May 29, 2000
1,683
CA
Hi All,

I am having a problem with a php / mysql site. I have a standard conn.php file that holds the host,username, password, and DB name. This was working until yesterday, when the connection started ignoring the php pages.

The message in the logs on mysql indicate that I am not a valid user and that it is ignoring me. I have been using phpmyadmin to administer the DB successfully and can see the need info in the user table.

Has anyone else had a similar problem and how have you resolved it?

TIA
Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Please could you post:
1. Your
Code:
conn.php
file
2. The mysql
Code:
user
table
3. The error message you're getting (if any)

This might help identify the problem.

-Rob
 
Hi All,

I have a conn.php page like this:
$username = "Bastien";
$pwd = "sweden";
$host = "localhost";
$dbname = "Gulfstream";

if (!($conn=mysql_connect($host, $username, $pwd))) {
printf("error connecting to DB by user = $username and pwd=$pwd");
exit;
}
$db=mysql_select_db($dbname,$conn) or die("Unable to connect to database1");

then I have a prod.php which takes a variable in a querystring and tries to hit the DB where I get this:

Fatal error: Failed opening required 'dbconng' (include_path='') in C:\Inetpub\ on line 9

yet in the file, it looks like this:
require("commonmn.php");


//header logo
$msg1 = "";
HTMLHeader(); //function to print header
require("dbconng"); //is on line 9
$SQLProd = "select * from gulf_products where prod_name = $prod";

$SQLResult = mysql_query($SQLProd, $conn) or die ("Couldn't execute query1");
echo&quot; <table width = 600 valign = top>&quot;;
//pass the info to the screen
$row = mysql_fetch_array($SQLProdGet);

I checked the mySQL error file in the WinMySQLAdmin and get this error

Aborted connection 4 to db: 'unconnected' user: 'Bastien'
host: 'localhost'

This was working for the last few days and has now crapped out on me

any help would be wonderful

TAI
Bastien

There are many ways to skin this cat,
but it still tastes like chicken

Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
It seems as if the problem is with the
Code:
require
statement rather than your database (if I assume correctly that
Code:
dbconng
either
Code:
require
s or
Code:
include
s
Code:
conn.php
).

Some things to check:
1. Do
Code:
products.php
and
Code:
dbconng
reside in the same directory?
2. Try adding a suffix to
Code:
dbconng
such as
Code:
.php
or
Code:
.inc
3. Try specifying the full paths in your
Code:
require
statements
4. Check if it really is a database issue by attempting to connect to your database using the native
Code:
mysql
client, and the same username/password combination.

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top