connect database mysql heroku code example
Example 1: connect to db heroku
heroku pg:psql -f schema.sql -a HEROKU_APP_NAME
Example 2: heroku mysql
<?php
$url = parse_url(getenv("CLEARDB_DATABASE_URL"));
$server = $url["host"];
$username = $url["user"];
$password = $url["pass"];
$db = substr($url["path"], 1);
$conn = new mysqli($server, $username, $password, $db);
?>