php - New mysqli connection is not working in My Cpanel but works in my computer -


this question has answer here:

php code functioning in computer whenever uploading files cpanel not working receiving error message:

warning: mysqli::mysqli() [mysqli.mysqli]: (42000/1044): access denied user '*****'@'localhost' database '*****' in /home/*****/public_html/admin panel/db.php on line 3 unable connect database [access denied user '*****'@'localhost' database '*****']

my username , password both 100% correct don't know why receiving this.

<?php     $connection=new mysqli('localhost', 'cpanelname_username', 'test.123', 'cpanelname_db');     if($connection->connect_errno > 0){         die('unable connect database [' . $connection->connect_error . ']');     } ?> 

check if localhost should used.

many shared hosting providers may not have database on same machine. check database hostname , change accordingly.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -