1. phpinfo ເພື່ອຫາ Extension ໃນ ເຄື່ອງເຮົາວ່າຮອງຮັບການຂຽນແບບ PDO ໄດ້ບໍ
=======================================
<?php
phpinfo();
?>
=======================================
Run ຜ່ານ localhost/PDO(PDO ແມ່ນຊື່ໄຟລ໌ Server ຈຳລອງຂອງເຮົາ ໃຫ້ຕັ້ງຊື່ຕາມເລີຍ)/phpinfo.php
Extension to PDO |
ເມື່ອຕິດຕັ້ງແລ້ວ ມາເຂົ້າສູ່ການຂຽນ ຕິດຕໍ່ກັບຖານຂໍ້ມູນເລີຍ
con.php
=======================================
<?php
$serverName = "localhost";
$userName = "root";
$userPassword = "44@44";
$dbName = "mydatabase";
$conn = new PDO('mysql:host=localhost;dbname=mydatabase', $userName, $userPassword);
$conn->exec("set names utf8");
if($conn){
echo "Successfully to Connection ";
}else{
echo "Can't to Successfully Connection";
}
?>
=======================================
references Read More : http://php.net/manual/en/book.pdo.php
ไม่มีความคิดเห็น:
แสดงความคิดเห็น