PHP

PHP Crud İşlemleri

INSERT

  $kaydet=$db->prepare("INSERT INTO post SET

  username=:username,
  icerik=:icerik,
  durum=:durum,
  tarih=:tarih
  


  ");

$insert=$kaydet->execute(array(


  'username'=>"cagrigungor",
  'icerik'=>$_POST["icerik"],
  'durum'=>0,
  'tarih'=>date('Y-m-d H:i:s')
  


));


SELECT FETCHALL

$postlar = $db->prepare("SELECT * FROM post ORDER BY id DESC");
$postlar->execute();
$postlarigoster = $postlar->fetchAll();

SELECTFETCH

$uyeler = $db->prepare("SELECT * FROM user WHERE user_id=:user_id");
$uyeler->execute([":user_id"=>$_GET['id']]);
$uyelerigoster = $uyeler->fetch(PDO::FETCH_ASSOC);

UPDATE

  $kaydet=$db->prepare("UPDATE user SET

  user_isim=:user_isim,
  user_soyisim=:user_soyisim,
  user_username=:user_username,
  user_telefon=:user_telefon,
  user_email=:user_email

  WHERE user_id={$_POST['user_id']}
  


  ");

$insert=$kaydet->execute(array(


  'user_isim'=>$_POST["user_isim"],
  'user_soyisim'=>$_POST["user_soyisim"],
  'user_username'=>$_POST["user_username"],
  'user_telefon'=>$_POST["user_telefon"],
  'user_email'=>$_POST["user_email"]
  


));
0 0 votes
Article Rating
Subscribe
Bildir
guest
0 Yorum
Inline Feedbacks
View all comments