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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.