I have two database chinmay235 and desarrollo_forum
I want to join two table nuke_follow_votes and smf_members using JOIN query.
nuke_follow_votes table exist in chinmay235 and smf_members exist in desarrollo_forum database.
Code :
<?php
$dbhost = "localhost";
$dbuname = "chinmay_db";
$dbpass = "2014@movie";
$dbname = "chinmay235";
mysql_connect($dbhost,$dbuname,$dbpass) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$qry = mysql_query("SELECT a.* FROM chinmay235.nuke_follow_votes a LEFT JOIN desarrollo_forum.smf_members b ON a.user_id=b.id_member WHERE b.user_id IS NOT NULL;") or die(mysql_error());
$res=mysql_fetch_row($qry);
echo "Total Record = ".mysql_num_rows($qry);
?>
Output :
SELECT command denied to user 'chinmay235'@'localhost' for table 'smf_members'
I am successfully connect the chinmay235 and getting the table nuke_follow_votes but problem is unable to connect the second database.
Please help me how can i connect and join this two table and get the data correct data.
This is just a permission issue.
It seems your user can't select table on the database desarrollo_forum.
Check the permissions for your user with the following command.
SHOW GRANTS FOR 'chinmay235'@'localhost';
You can add grants with the GRANT command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With