【发布时间】:2019-09-26 20:15:23
【问题描述】:
我有一个包含数据库信息的列表,每条记录旁边都有一个用于编辑记录数据的按钮。问题是当我尝试发送我要编辑的注册表的 id 时,我总是收到相同的输出,简单的单词:Array。
这是桌子:
<th><?php echo $row_usuario["id_employee"]; ?></th>
<td><?php echo $row_usuario["nome"]; ?></td>
<td><?php echo $row_usuario["email"]; ?></td>
<td>
<a href="#Edit" id="custId" data-toggle="modal" data-id=" '.$row_usuario['id_employee'].'">
<i class="material-icons" style="color:#2A6F46">edit</i>
</a>
</td>
ajax:
$(document).ready(function(){
$('#Edit').on('show.bs.modal', function (e) {
var rowid = $(e.relatedTarget).data('id');
$.ajax({
type : 'post',
url : 'list_emp.php',
data : 'rowid='+ rowid,
success : function(data){
$('.fetched-data').html(data);//Show fetched data from database
}
});
});
});
查询部分:
//database connection include before this
if($_POST['rowid']) {
$id = $_POST['rowid'];
//here is the problem, i'm not receiving the real id, just the word "Array" and i can't run the query because this
}
模态:
<div class="fetched-data">Here i want to show the form with the info to be edit</div>
谁能帮我找出错误?
【问题讨论】:
标签: javascript php jquery mysql ajax