2015-08-26 9 views
0

Я пытаюсь обновить запись в моей базе данных, но после отправки формы она не возвращается на страницу Committee.php, и записи не обновляются. Есть ли проблемы с моим запросом?запрос обновления не работает с моим кодом

<?php 
    include_once('connection.php'); 




    if(isset($_GET['details_id'])) 
    { 
     $id=$_GET['details_id']; 
     if(isset($_POST['submit'])) 
     { 


      $title = $_POST['title']; 
      $pageno = $_POST['page']; 
      $author = $_POST['author']; 
      //$authorimg = $_POST['image']; 

      $article_status = $_POST['articlestatus']; 
      $sketch_status = $_POST['sketchstatus']; 
      $final_approval_person = $_POST['finalperson']; 
      $final_approval_date = $_POST['finaldate']; 
      $status = $_POST['status']; 

         $query = "update details set title='$title', page_no='$pageno', author='$author', article_status='$article_status', sketch_status='$sketch_status', final_approve_person='$final_approval_person', final_approve_date='$final_approval_date', status='$status', where id=$id"; 

     $res = mysqli_query($DBCONNECT,$query);  


     if($res) 
     { 
      header('location:committee.php'); 
     } 
     else 
     { 
      echo mysql_error(); 
     } 


     } 

    } 


?> 


<!DOCTYPE html> 
<html> 
<head> 
</head> 
<body style="margin-left:30%;"> 

<div class="form-style-2"> 
<div class="form-style-2-heading">Provide Following Information</div> 
<form action="" method="post"> 
<label for="field1"><span>Title <span class="required">*</span></span><input type="text" class="input-field" name="title" value="" /></label> 

<label for="field1"><span>Page No. </span><input type="number" class="input-field" name="page" 
    min="0" max="100" step="10" value="30"></label> 

<label for="field2"><span>Author <span class="required">*</span></span><input type="text" class="input-field" name="author" value="" /></label> 

<label for="field1"><span>Author Image <span class="required">*</span></span><input type="file" class="input-field" name="image" value="" /></label> 

<label for="field4"><span>Article Status</span><select name="articlestatus" class="select-field"> 
<option value="notrecieved">Not Recieved</option> 
<option value="recieved">Recieved</option> 
</select></label> 

<label for="field4"><span>Sketch Status</span><select name="sketchstatus" class="select-field"> 
<option value="notapproved">Not Approved</option> 
<option value="approved">Approved</option> 
</select></label> 

<label for="field2"><span>Final Approval Person <span class="required">*</span></span><input type="text" class="input-field" name="finalperson" value="" /></label> 

<label for="field2"><span>Final Approval Date <span class="required">*</span></span><input type="date" class="input-field" name="finaldate" value="" /></label> 

<label for="field2"><span>Status <span class="required">*</span></span><input type="text" class="input-field" name="status" value="" /></label> 





<!--<label for="field4"><span>Regarding</span><select name="field4" class="select-field"> 
<option value="General Question">General</option> 
<option value="Advertise">Advertisement</option> 
<option value="Partnership">Partnership</option> 
</select></label> 
<label for="field5"><span>Message <span class="required">*</span></span><textarea name="field5" class="textarea-field"></textarea></label> 
--> 
<label><span>&nbsp;</span><input type="submit" value="submit" name="submit" /></label> 
</form> 
</div> 


</body> 
</html> 
+0

Включить отчет об ошибках 'error_reporting (E_ALL); ini_set ("display_errors", 1); '<- поместите это вверху вашего файла, вы увидите свою ошибку, основная отладка будет такой же частью кодирования, как и запись. – Epodax

+0

imget без ошибок – Nishant

+0

после подачи является не только показывает пустую форму – Nishant

ответ

0

Ваш запрос неверен. Используйте этот

$query = "update details set title='$title', page_no='$pageno', 
    author='$author', article_status='$article_status', 
    sketch_status='$sketch_status', final_approve_person='$final_approval_person', 
    final_approve_date='$final_approval_date', status='$status' where id=$id"; 

Нет необходимости запятой здесь status='$status', where id=$id

добавить также одинарные кавычки для $ ид в ИНЕКЕ.

+0

не получив никакого результата ..... – Nishant

+0

Добавить одиночную кавычку за $ ид в котором пункт –

+0

я я положить это правильно на моем кнопку редактирования с страницы комитета.php? – Nishant

Смежные вопросы