Jump to content
php.lv forumi

Pieslēgties datubāzei


djmartins

Recommended Posts

Ja es esmu izveidojies uz bemzaksas hostinga datubāzi ar parametriem:

 

$host: fdb3.runhosting.com

$user: 123

$password: 123

 

Pati mājas lapa atrodās uz cita hostinga, kā īsti varu pieslēgties šai konkrētajai datubāzei, kura atrodās, savukārt, uz cita hostinga?

 

Izmantojot zemak redzamo kodu, parāda kļūdas paziņojumu:

A connection attempt failed because the connected party did not

 

<?php
$host= 'fdb3.runhosting.com';
$user='123';
$password='123';
$link = mysql_connect('$host', '$user', '$password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

Edited by djmartins
Link to comment
Share on other sites

...un nedomāju ka arī tas būs risinājums. hostingiem parasti ugusmūris nelaiž klāt pie mysql no ārpuses.

 

Tieši tā. Es ar vienreiz kautko tamlīdzīgu biju mēģinājis un nefiga.

Beigās vai nu lapu hosto tur pat, vai db pārnes uz citurieni.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...