Get error "SQLSTATE [HY000] [2002] Connection denied"

is there something wrong with my code?

<?php try { $db = new PDO('mysql:host=files.000webhost.com;dbname=id5732426_kbp','sekolah-mimpi', 'webpassword'); } catch (PDOException $e) { echo $e->getMessage(); die(); } ?>

Helle there, Please can you give us more clear report on what you were doing when you encounter this problem?

2 Likes

host is LOCALHOST
not what you have written above.