我想用php更新数据

时间:2018-11-04 20:24:13

标签: php html database pdo

我想用PHP更新数据。当我单击按钮时,页面将刷新,并且不会发生更新。如何纠正

我的代码: 档案名称:Contact_settings

<form action="../netting/islem.php"  method="post" class="form-horizontal form-label-left">
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Gsm Number<span class="required">*</span></label>
    <div class="col-md-6 col-sm-6 col-xs-12">
        <input type="text"  name="ayar_tel"  value="<?php echo $ayarcek['ayar_tel'] ?>" required="required" class="form-control col-md-7 col-xs-12">
    </div>

<div class="form-group">
 <div align="right" class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
    <button type="submit" name="iletisim" class="btn btn-success right">Güncelle</button>
 </div>
  </div>

文件名:islem.php

if(isset($_POST['iletisim'])){

$ayarkaydet = $db->prepare("UPDATE ayar SET
      ayar_tel       =:ayar_tel,
      WHERE ayar_id=3
  ");
$update = $ayarkaydet->execute
(
    array(
        ':ayar_tel'       => $_POST['ayar_tel'],

    )
);

1 个答案:

答案 0 :(得分:-1)

您的代码有误

必须是这样

min(order_time)

我在sql的where和execute数组中删除了两个逗号,并为if句子添加了一个close}。