Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

PHP pconnect errors


lukem_95's Avatar
Member
0 0

Ok i wrote an admin center script for my site [scoliomedia.co.uk] which seems fine, and requires('filename.php') a databse login script:

<?php
// MySql Connections
$dbhost='dbdomain.domain.com';
$dbusername='username';
$dbuserpass='XXXXXXXXX';
$dbname='dbname';

//-------------------------------
// Connect To MySQL
//-------------------------------
mysql_pconnect($dbhost, $dbuser, $dbuserpass) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
?>

However when i run the script and try to login i get

Access denied for user 'XXXXXXXXX'@'XXX.XXX.XXX.XX' (using password: YES)

note: the XXXXXXXXX is my login for FTP, not the database :S And the other bit is an IP address (presumably my hosting server [1and1.co.uk])

Please help.


ghost's Avatar
0 0

Well, three things

  1. Password could be wrong
  2. Your server may only allow connections from localhost
  3. You haven't specified the port to connect to

lukem_95's Avatar
Member
0 0

ah…. well i can connect because the DB comes witht eh hosting, and i use it for my forum which works fine, and the pass is 100% fine, but you have to specify a port? iv never seen that before, could give me the syntax and/or an example bit of code pl0x?


ghost's Avatar
0 0

It's not that you've got the wrong port, the error would be different. But it could be that they ony allow connections from set hosts, such as only from localhost.

At first glance the error is that you set $dbusername but then later read $dbuser .


lukem_95's Avatar
Member
0 0

thankyou, that fixed it, pmg watta noob, i shoulda checked, thts what comes frm using bits of your old scripts ad not checking :S


lukem_95's Avatar
Member
0 0

thankyou, that fixed it, pmg watta noob, i shoulda checked, thts what comes frm using bits of your old scripts ad not checking :S