如何在按钮单击中编辑数据库vlaue
问题描述:
嗨朋友们,
我有一个动态表,它是由数据库查询和逐行输出的值组装的。
现在我想在每个上面放一个编辑按钮行和想要在该按钮上编辑功能
意味着当我点击该编辑按钮时,我可以编辑这些值。
如果你们有任何想法与此有关那么请让我们我尽快知道
这是我的代码。
Hi friends,
I have a dynamic table which is crating by database query and value coming row by row.
Now i want to put a edit button on every row and want edit function on that button
Means when i click that edit button, i can edit those value.
if any of you have any idea related this then pls let me know ASAP
here is my code.
<?php
}
else if(isset($_POST['submit_lo_a'])){
include("../dbconfig.php");
$query=mysql_real_escape_string($_POST['search_type2']);
$query_for_result=mysql_query("SELECT * FROM local_reimbursement where ((User_id) like '%".$query."%' or (name) like '%".$query."%' or (Reimbursement_type) like '%".$query."%') AND status='Approve'");
$num=mysql_num_rows($query_for_result);
echo <<<end
<table align="right" >
<tr>
<td bgcolor="#6fa34f" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; padding:5px 5px 5px 5px; color:#FFFFFF;" >Total Result Search</td><td> </td><td bgcolor="#044396" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; padding:5px 5px 5px 5px; color:#FFFFFF;">$num</td>
</tr>
</table>
end;
mysql_close();
?>
<div style="height:500px; overflow:scroll; width:910px;">
<table width="910" cellspacing="0" cellpadding="5" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; color:#000000; background:#f3f3f3; padding:1px 1px 1px 1px; text-align:left;">
<tr style="font-size:12px; text-align:left;">
<!--<td bgcolor="#CCCCCC" >Local Reimbursement Id</td>-->
<td bgcolor="#CCCCCC" >User Id</td>
<td bgcolor="#CCCCCC">Name</td>
<td bgcolor="#CCCCCC">Type</td>
<td bgcolor="#CCCCCC">From</td>
<td bgcolor="#CCCCCC">To</td>
<td bgcolor="#CCCCCC">Cities</td>
<td bgcolor="#CCCCCC">Days</td>
<td bgcolor="#CCCCCC">Bills</td>
<td bgcolor="#CCCCCC">Remarks</td>
<td bgcolor="#CCCCCC">Amount</td>
<td bgcolor="#CCCCCC">Apply Date</td>
<td bgcolor="#CCCCCC">Apply time</td>
<td bgcolor="#CCCCCC">Status</td>
<td bgcolor="#CCCCCC">Pending</td>
<td bgcolor="#CCCCCC">Edit</td>
</tr>
<!--</table>-->
<?php
$i=0;
while ($i < $num)
{
$f0=mysql_result($query_for_result,$i,"lo_reim_id");
$f1=mysql_result($query_for_result,$i,"User_id");
$f2=mysql_result($query_for_result,$i,"name");
$f3=mysql_result($query_for_result,$i,"Reimbursement_type");
$f4=mysql_result($query_for_result,$i,"re_from");
$f5=mysql_result($query_for_result,$i,"re_to");
$f6=mysql_result($query_for_result,$i,"cities");
$f7=mysql_result($query_for_result,$i,"no_of_days");
$f8=mysql_result($query_for_result,$i,"bills");
$f9=mysql_result($query_for_result,$i,"remarks");
$f10=mysql_result($query_for_result,$i,"amount");
$f11=mysql_result($query_for_result,$i,"apply_date");
$f12=mysql_result($query_for_result,$i,"apply_time");
$f13=mysql_result($query_for_result,$i,"status");
?>
<tr valign="top" >
<!--<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;" ><?php echo $f0; ?></td>-->
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;" ><?php echo $f1; ?></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;"><?php echo $f2; ?></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;"><?php echo $f3; ?></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;"><?php echo $f4; ?></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;" ><?php echo $f5; ?></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;"><?php echo $f6; ?></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;"><?php echo $f7; ?></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;"><?php echo $f8; ?></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;"><?php echo $f9; ?></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;"><?php echo $f10; ?></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;"><?php echo $f11; ?></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;"><?php echo $f12; ?></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;"><a href="dis-reimbursement-loc.php?lo_reim_id=<?php echo $f0; ?>" ><?php echo $f13; ?></a></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;"><a href="pen-reimbursement-loc.php?lo_reim_id=<?php echo $f0; ?>" ><?php echo $f13; ?></a></td>
<td style="border-bottom:#cdcdcd solid; border-bottom-width:1px;">Edit Button</td>
</tr>
<?php
$i++;
}
////
}
?>
</table>
</div>
thanks
thanks
答
_POST['submit_lo_a'])){
include(\"../dbconfig.php\");
_POST['submit_lo_a'])){ include("../dbconfig.php");
query=mysql_real_escape_string(
query=mysql_real_escape_string(
_POST['search_type2']);
_POST['search_type2']);