2012-08-15 43 views
0

我试图开发使用PHP Heroku的一个PHP应用程序....使用xeround,Heroku的,PHP

我已经做了添加了添加使用的链接 - https://devcenter.heroku.com/articles/xeround#connecting-to-xeround

现在,我试图查询数据库杨只是一个简单的查询,但不显示任何错误。

我可以知道连接字符串是否仍然需要吗?如果需要的话,我可以知道作为主机应该放什么东西吗?

如果有任何后续问题需要,请让我知道。

在此先感谢!

回答

0

你可以试试这个:

$url=parse_url(getenv("DATABASE_URL")); 

$server = $url["host"]; 
$username = $url["user"]; 
$password = $url["pass"]; 
$port = $url["port"]; 
$db = substr($url["path"],1); 

$link = mysql_connect($server . ":" . $port, $username, $password); 
if (!$link) { 
    die('Could not connect: ' . mysql_error()); 
} 
echo 'Connected successfully'; 

[来源:https://devcenter.heroku.com/articles/cleardb#using-cleardb-with-php]

希望它能帮助:)