Jump to content

Php/Mysql connect


wipe

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
Link to comment
https://forums.phpfreaks.com/topic/11531-phpmysql-connect/
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]
Link to comment
https://forums.phpfreaks.com/topic/11531-phpmysql-connect/#findComment-43409
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.
Link to comment
https://forums.phpfreaks.com/topic/11531-phpmysql-connect/#findComment-43413
Share on other sites

Archived

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

×
×
  • Create New...

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.