我的项目php有问题, 我无法更新MySQL中的特定表格,我不知道此代码有什么问题:
<?php defined('login') or die('Restricted access'); $id_o_u_a = $_GET['id_o_u_a']; if(!empty($id_o_u_a)){ $query = $koneksi->query("select *from organisasiumatanggota where id_o_u_a='$id_o_u_a'"); $data $query>fetch_array();extract($data);}?><style type="text/css"media="screen">.judul_input{font-weight: bold; }#form_input tr{height:45px;}</style>
<div class="panel-body">
<form class="form-horizontal" role="form" method="POST" action="index.php?page=prosesubahorganisasiumatanggota">
<table width="60%" id="form_input">
<div class="panel-body">
<tr>
<td class="judul_input">Nama</td>
<input name="id_organisasi" type="hidden" value="<?php echo $id_o_u_a;?>" >
<td> <select name="nama" class="form-control">
<?php
$query = $koneksi->query("select *from umatanggota order by id desc");
if($query->num_rows != 0){
while($data = $query->fetch_array()){
echo "<option value=$data[id] >$data[nama]</option>";
}
}
?></td></select> </tr>
<tr>
<td class="judul_input">Nama Organisasi</td>
<td> <select name="id_organisasi" class="form-control">
<?php
$query = $koneksi->query("select *from organisasi order by id_organisasi desc");
if($query->num_rows != 0){
while($data = $query->fetch_array()){
echo "<option value=$data[id_organisasi] >$data[nama_organisasi]</option>";
}
}
?></td></select> </tr>
<tr>
<td class="judul_input">Nama Jabatan</td>
<td> <select name="id_organisasi" class="form-control">
<?php
$query = $koneksi->query("select *from jabatan order by id_jabatan desc");
if($query->num_rows != 0){
while($data = $query->fetch_array()){
echo "<option value=$data[id_jabatan] >$data[jns_jabatan]</option>";
}
}
?></td></select> </tr>
</table>
<input type="submit" class="btn btn-primary" value="SIMPAN" name="submit">
</form>
这是我处理sql数据的代码
<?php
defined('login') or die('Restricted access');
extract($_POST);
if(empty($id)){
header("location:index.php?page=tambahorganisasiumatanggota&pesan=data masih kosong");
exit;}
$query = $koneksi->query("update organisasiumatanggota set id='$id', id_organisasi='$id_organisasi', id_jabatan='$id_jabatan' where id_o_u_a='$id_o_u_a'") or die(mysqli_error()); if($query){
header("location:index.php?page=organisasiumatanggota&pesan=data sudah disimpan");
exit;
}else{
header("location:index.php?page=tambahorganisasiumatanggota&pesan=data gagal disimpan");
exit;
}?>