Connection error, works on one server not other!?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

Connection error, works on one server not other!?

Post by robster »

Hi all,

I have two servers, a test and real one (obviously ;) ).
The problem I'm having is located at: http://10secondclub.net/jobs.php?sort=dateasc so you can see it for yourself. The site is still under development but you get the idea :)

Basically, the password in the config.php is DEFINATELY correct. I have an admin panel for my jobs area and it uses the same file and can connect and run not a problem, so it's not the password or username etc.

Here's the code that it errors with:

Code: Select all

require("config.php");


$dbLink = @mysql_connect($dbasehost,$dbaseuser, $dbasepassword);
	mysql_select_db($dbase);
                   $sql="Select * FROM jobnum ORDER BY recordid ASC";
                   $result = mysql_query ($sql,$dbLink) or die( "oh no, there's a problems getting job list from the database.");

                     While ($row = mysql_Fetch_array($result)){
                    $user=$row['username'];
                    $pass=$row['password'];
                    }
                   mysql_close();

Can anyone see any glaring problems? I'm tearing my hair out... Surely it's so simple.

:)

Thanks !

Rob
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

maybe

Code: Select all

require("config.php");

$dbLink = @mysql_connect($dbasehost,$dbaseuser, $dbasepassword) or die('oh no, there is a problem with connecting the database server: '.mysql_error());
mysql_select_db($dbase) or die('oh no, there is a problem with selecting the database: '.mysql_error());;
$sql="Select * FROM jobnum ORDER BY recordid ASC";
$result = mysql_query ($sql,$dbLink) or die( "oh no, there's a problem getting job list from the database: ".mysql_error());

While ($row = mysql_Fetch_array($result)){
	$user=$row['username'];
	$pass=$row['password'];
}
mysql_close();
can shed some light on the problem.
Although it might not be a good idea exposing mysql_error() to every user it will help you now.
User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

Post by robster »

ok, thanks for that, the error it now gives (to the world at large, all 2000 of them a day!!!! ;) is

Parse error: parse error in /home/tsecond/public_html/jobs/job.php on line 11
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

and lines 10 to 12 are?
Post Reply