PHP İLE UPDATE

tamer555 Tamer Meydan

CREATE TABLE IF NOT EXISTS `haberler` (

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `haberbasligi` varchar(255) NOT NULL,

  `habericerigi` text NOT NULL,

  `habereklenmetarihidamgasi` varchar(255) NOT NULL,

  `habereklenmetarihi` varchar(255) NOT NULL,

  `sondakikabitissuresidamgasi` varchar(255) NOT NULL,

  `sondakikabitissuresi` varchar(255) NOT NULL,

  PRIMARY KEY (`id`)

Yukarıdaki tabloya göre verileri güncellemek istiyorum ancak <select name="sure">

    <option value="1">1 Dakika</option> güncelletemedim . Bu kısmı nasıl güncellerim? Dosyalar aşağıdaki gibi ....

 

-- haberekle.php --- 

<?php

include("../ayar.php");

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Haber Uygulaması - Yönetim</title>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-9" />

<meta http-equiv="content-language" content="TR" />

</head>

<body>

<form name="haberformu" method="post" action="habereklesonuc.php"><table width="500" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

    <td height="20" colspan="3" align="center" valign="middle" bgcolor="#FF0000"><font color="#FFFFFF"><b>Haber Ekleme Formu</b></font></td>

  </tr>

  <tr>

    <td width="140" height="20" align="left" valign="top">Haber Başlığı</td>

    <td width="20" height="20" align="left" valign="top">:</td>

    <td width="340" height="20" align="left" valign="top"><input type="text" name="baslik" size="50" /></td>

  </tr>

  <tr>

    <td height="20" align="left" valign="top">Haber İçeriği</td>

    <td height="20" align="left" valign="top">:</td>

    <td height="20" align="left" valign="top"><textarea name="icerik" rows="10" cols="39"></textarea></td>

  </tr>

  <tr>

    <td height="20" align="left" valign="top">Süresi</td>

    <td height="20" align="left" valign="top">:</td>

    <td height="20" align="left" valign="top"><select name="sure">

    <option value="1">1 Dakika</option>

    <option value="2">2 Dakika</option>

    <option value="3">3 Dakika</option>

    <option value="4">4 Dakika</option>

    <option value="5">5 Dakika</option>

    </select></td>

  </tr>

  <tr>

    <td height="20" align="left" valign="top">&nbsp;</td>

    <td height="20" align="left" valign="top">&nbsp;</td>

    <td height="20" align="left" valign="top"><input type="submit" value="Kaydet ve Yayınla" /></td>

  </tr>

</table></form>

</body>

</html>

 

--- haberduzenle.php ----

<?php

include("../ayar.php");

$gelenid       =@$_GET["id"];

$istenilenkaydisor   =@mysql_fetch_assoc(@mysql_query("SELECT * FROM haberler WHERE id='$gelenid' ORDER BY id ASC LIMIT 1"));

    $kayittarih        =    date("d.m.Y H:i:s");

$kayitid   =@trim(@strip_tags(@addslashes($istenilenkaydisor["id"])));

$kayitbaslik       =@trim(@strip_tags(@addslashes($istenilenkaydisor["haberbasligi"])));

$kayiticerik   =@trim(@strip_tags(@addslashes($istenilenkaydisor["habericerigi"])));

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Haber Uygulaması - Yönetim</title>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-9" />

<meta http-equiv="content-language" content="TR" />

</head>

<body>

<form name="haberformu" method="post" action="haberguncelle.php"><table width="500" border="0" align="center" cellpadding="0" cellspacing="0">

<input type="hidden" name="islemid" value="<?=$gelenid?>">

  <tr>

    <td height="20" colspan="3" align="center" valign="middle" bgcolor="#FF0000"><font color="#FFFFFF"><b>Haber Ekleme Formu</b></font></td>

  </tr>

  <tr>

    <td width="140" height="20" align="left" valign="top">Haber Başlığı</td>

    <td width="20" height="20" align="left" valign="top">:</td>

    <td width="340" height="20" align="left" valign="top"><input type="text" name="baslik" size="50" value="<?=$kayitbaslik?>"/></td>

  </tr>

  <tr>

    <td height="20" align="left" valign="top">Haber İçeriği</td>

    <td height="20" align="left" valign="top">:</td>

    <td height="20" align="left" valign="top"><textarea name="icerik" rows="10" cols="39"> <?=$kayiticerik?></textarea></td>

  </tr>

  <tr>

    <td height="20" align="left" valign="top">Süresi</td>

    <td height="20" align="left" valign="top">:</td>

    <td height="20" align="left" valign="top"><select name="sure">

    <option value="1">1 Dakika</option>

    <option value="2">2 Dakika</option>

    <option value="3">3 Dakika</option>

    <option value="4">4 Dakika</option>

    <option value="5">5 Dakika</option>

    </select></td>

  </tr>

  <tr>

    <td height="20" align="left" valign="top">&nbsp;</td>

    <td height="20" align="left" valign="top">&nbsp;</td>

    <td height="20" align="left" valign="top"><input type="submit" value="Haber Güncelle" /></td>

  </tr>

</table></form>

</body>

</html>

 

--- haberguncelle.php ----

<?php

include("../ayar.php");

$kayitid   =  @trim(@strip_tags(@addslashes($_POST["islemid"])));

$kayitbaslik   =  @trim(@strip_tags(@addslashes($_POST["baslik"])));

$kayiticerik   =  @trim(@strip_tags(@addslashes($_POST["icerik"])));

if(($kayitbaslik!="") and ($kayiticerik!="")){

$guncelle =@mysql_query("UPDATE haberler SET haberbasligi='$kayitbaslik', habericerigi='$kayiticerik' WHERE id='$kayitid' ORDER BY id DESC LIMIT 1");

if($guncelle){

@header("location:tamam.php");

}else{

@header("location:hata.php");

}

}else{

@header("location:hata.php");

}

?>

29-06-2016 11:45

    Php

    $guncelle =@mysql_query("UPDATE haberler SET haberbasligi='$kayitbaslik'");

    Burda mavi gösterdiğim parantezi kapatmamışsın. Kodları yazarken hepsini alt alta yazman sıkıntı doğurur, ayrı ayrı dosyalara koyabilirsin.

    Her programcı birgün Php yi tadacaktır
    02-07-2016 04:42

      www.Phpkodlari.com © 2009 Herkes Php öğrenecek
      Web tasarım ve eğitim kaynağınız.