having problems

Plz post the code of connect.php so we can see what you've done
wrong.

It seems to me you've not configged your script correctly.You have
to fill in your database username and pass,...
 
Yeh i have filled in the db info correctly...

This is the connect.php file for the topsites folder...

<?
$db = mysql_connect("$dbhost","$user","$pass") or die ("Can't connect to mySQL server");
mysql_select_db ("$dbname") or die (mysql_error());
?>

the help is much appriciated, thanks
 
Hi,

I think that the error information in your site is very clear:

Code:
Notice: Undefined variable: dbhost in D:\hshome...

Notice: Undefined variable: user in D:\hshome\...

Notice: Undefined variable: pass in D:\hshome\...

It tells that your variables are undefined. So, where have you defined them?

You should have something like this:


Code:
<?
$dbhost = "mysql.jodoshared.com";
$user = "myuser";
$pass = "secret";

$dbname = "mysqldb";

$db = mysql_connect("$dbhost","$user","$pass") or 
          die ("Can't connect to mySQL server");
mysql_select_db ("$dbname") or die (mysql_error());
?>
 
Hmm, and the config.php is being included properly into the particular file? Because I don't see how you cou could get that error message if it is..

There should be a
PHP:
require_once(dirname(__FILE__) . '/config.php');
line on top of the file. Alternative it could read include/include_once/require instead of require_once, and the path thing can differ of course.
 
hurricane said:
they are defined in the config.php file

be sure that the script that includes connect.php, also includes config.php. Something like this:

Code:
<?php
include("config.php");

....

include("connect.php");

?>

On the other hand, are you including "connect.php" from inside a function? If so, you should declare the variables as "global" inside the function
 
some of the functions have

Global $dbname,$db;

but i cant see anywhere where connect.php is mentioned and i tryed including it but it didnt make much difference
 
hurricane said:
some of the functions have

Global $dbname,$db;

but i cant see anywhere where connect.php is mentioned and i tryed including it but it didnt make much difference

Then your code has serious problems I won't be able to diagnostic unless you email me it
 
Back
Top