Two domains using same mqsql database

April 25, 2015 1.5k views
Ubuntu MySQL PHP

I have two domains using the same droplet and same mysql database. The data is fetched and displayed fine for the first domain, but, the second domain doesn’t show any data.

Connecting to database and selecting the database is happening, but, the page (for the second domain) doesn’t display any data. What could possibly be the problem? Please help. Thanks.

<?php

$link = mysql_connect('localhost', 'username', 'passowrd') or die(mysql_error());
if ($link) 
{
echo ('Connect susscufully ..... and ...... '); 
} 
else 
echo ('Not connect');

mysql_select_db('enarexperts',$link) or die(mysql_error());
echo "Connected to Database";
?>
1 comment
1 Answer

Yes, same MySQL user and same code for both domains. I even tried to create a new mysql use and grant access, same result. I can connect to mysql database via putty fine.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!