having problems

I have installed 2 php topsite list scripts and created a MySQL db… I have changed the config.php files on both and they should work. But the problem is that they dont. The scripts throw up a lot of errors and problems and I am not a php programmer so any help on to what I can do would be great… Thanks…

http://hurricanesk8.com/topsites/index.php
http://hurricanesk8.com/toplist/index.php

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:

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:

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

they are defined in the config.php file

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’);[/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.

[QUOTE=hurricane]
they are defined in the config.php file
[/QUOTE]

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

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

[QUOTE=hurricane]
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
[/QUOTE]

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