Guest User

Untitled

a guest
Feb 23rd, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php // veri tabanı bağlantısı
  2. $ip = "localhost"; //host
  3. $user = "root"; // host id
  4. $password = ""; // password local olduğu için varsayılan şifre boş
  5. $db = "dbtest"; // db adı
  6.  
  7. //bağlantı
  8. try{
  9. $db = new PDO("mysql:host=$ip;dbname=$db",$user,$password);
  10. // türkçe karakter için utf8
  11. $db->exec("SET CHARSET UTF8");
  12. //eğer hata olursa pdo nun exception komutu ile ekrana yazdırıyoruz
  13. }catch(PDOException $e){
  14. die ("Hata var");
  15. }
  16. ?>
Add Comment
Please, Sign In to add comment