! PHP PDO connection MySQL failed

Source: Internet
Author: User
Help!! PHP PDO connection MySQL failed
In the conn.php with the PDO to connect to the local MySQL database, but the PHP Web page submitted by the data is not stored in MySQL, but run conn.php not error, do not know where the problem is!! Tangled up for three days!! Come on, guys, look.

 
 try {
$dns = ' mysql:host=localhost;dbname=satcliv8;port=3306 ';
$utilisateur = ' root ';
$motDePasse = ";
$connection = new PDO ($dns, $utilisateur, $motDePasse,
Array (Pdo::mysql_attr_init_command = "SET NAMES UTF8"));

} catch (Exception $e) {
echo "Connection?? MySQL impossible: ", $e->getmessage ();
Die ();
}
?>

------to solve the idea----------------------
You're just connecting.
How do you use it?
------to solve the idea----------------------
Http://www.w3cschool.cc/php/pdo-errorinfo.html
Use this to check MySQL error, try it
------to solve the idea----------------------
Look at the error log.
------to solve the idea----------------------
Host unknown is not found host, how do you connect? IP or domain name.
Put it on.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.