Jump to content


Photo

Php/Mysql connect


  • Please log in to reply
3 replies to this topic

#1 wipe

wipe
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 08 June 2006 - 10:00 PM

Hi guys,

i have 2 questions:

First- I'm trying to use an external SQL DB like this:

connect.php
<?
$dbhost = 'mysite.com';
$dbuser = 'user';
$dbpass = 'pass';
$dbname = 'db_name';
$dbcfg = 'vehicle_config';
$dbvin = 'vehicle_inventory';
$dbimg = 'vehicle_imagelist';
?>

in index.php everything works fine but when go to the second page (view.php) he lose the connection. I use the "Require" but return a DB problem.

Warning: mysql_connect(): Access denied for user 'wipe_msl'@'biham.lunarpages.com' (using password: YES) in /home/acomp2/public_html/mslacomp/view.php on line 6
I cannot connect to the database because: Access denied for user 'wipe_msl'@'biham.lunarpages.com' (using password: YES)


But this is the pass that a have chosed.

Can this be a security problem or just a script error?

----------------------------------------

2nd question:

how can i connect to several DB(in diferent hosts) and display as just one?

do i need some special connect? Do i need a script adjustment?

Best regards,
Wipe

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 08 June 2006 - 10:08 PM

1. Odd... It works for one page but not for another?

2. You can have different MySQL links but I never used this:

$link1 = mysql_connect('host', 'user1', 'pass1');
$link2 = mysql_connect('host2', 'user2', 'pass2');

But this is an annoyance since you'll have to define the link to use for everything you do:

mysql_query("SELECT * FROM table", $link1)

~ D Kuang

#3 wipe

wipe
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 08 June 2006 - 10:16 PM

[!--quoteo(post=381619:date=Jun 8 2006, 11:08 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 8 2006, 11:08 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
1. Odd... It works for one page but not for another?

2. You can have different MySQL links but I never used this:

$link1 = mysql_connect('host', 'user1', 'pass1');
$link2 = mysql_connect('host2', 'user2', 'pass2');

But this is an annoyance since you'll have to define the link to use for everything you do:

mysql_query("SELECT * FROM table", $link1)
[/quote]

Thats right. Works for the first page but not for the second.

#4 Fyorl

Fyorl
  • Members
  • PipPipPip
  • Advanced Member
  • 273 posts
  • LocationUK

Posted 08 June 2006 - 10:49 PM

are you using mysql_connect() or mysql_pconnect()? You might also want to post a support ticket to your web hosts asking why you're receiving access denied messages...
[table]



Don't worry, the printer fairies will sort it out.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users