Am facut un site2 si vreau sa afisez niste informatii aflate pe siteul1.
Siteul2 este pe alt server decat siteul1.
Acum am pe siteul2 asta:
unde db2.php contine<?php include ("db2.php");?>
<html>
<head>
metataguri
</head>
<body>
<?
$sql = "select * from articole where (idunic='$idunic' and titlu='$titlu')";
$result = mysql_query ($sql);
while($row = mysql_fetch_array($result)){
$idunic=$row["idunic"];
$titlu=$row["titlu"];
echo"
$titlu
"; ?>
</body>
</html>
<?php
$dbhost = "localhost";
$dbname = "numebazadedate2";
$dbuser = "username2";
$dbpasswd = "parola2";
$prefix = "";
if(!$db = @mysql_connect("$dbhost", "$dbuser", "$dbpasswd"))
die('Check $dbhost, $dbuser, and $dbpasswd in config.php.');
if(!@mysql_select_db("$dbname",$db))
die("Unable to find the database <b>$dbname</b> on your MySQL server.");
?>
Acum am pus la inceput 2 includeuri ,ca sa accesez ambele baze de date,apoi sa afisez informatiile,dar imi da eroare la conectarea db1.php
<?php include ("db1.php");?>
<?php include ("db2.php");?>
db1.php contine
eroarea este: An Error OccurredUnable to connect to the database.Check $dbhost, $dbuser, and $dbpasswd in config.php. La $dbhost = "siteul1.com"; am inlocuit siteul1.com cu ip-ul siteului sau cu ip:port si tot nu merge.<?php
$dbhost = "siteul1.com";
$dbname = "numebazadedate1";
$dbuser = "username1";
$dbpasswd = "parola1";
$prefix = "";
if(!$db = @mysql_connect("$dbhost", "$dbuser", "$dbpasswd"))
die('Check $dbhost, $dbuser, and $dbpasswd in config.php.');
if(!@mysql_select_db("$dbname",$db))
die("Unable to find the database <b>$dbname</b> on your MySQL server.");
?>



Răspunde cu citat