Jump to content

Archived

This topic is now archived and is closed to further replies.

wipe

Php/Mysql connect

Recommended Posts

Hi guys,

i have 2 questions:

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

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

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.
[i]
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)[/i]

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

Share this post


Link to post
Share on other sites
1. Odd... It works for one page but not for another?

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

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

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

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

Share this post


Link to post
Share on other sites
[!--quoteo(post=381619:date=Jun 8 2006, 11:08 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 8 2006, 11:08 PM) [snapback]381619[/snapback][/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:

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

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

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

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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.