请问:在php中如何相应事件
我的程序是在一个table中,我在某些框直接编辑,然后离开时就直接写入数据库中。
(我把参数直接传递到php中的函数中)。可是不知道为什么程序没有反应,
请看:
《?php
function UpdateInfo($arg_1,$arg_2)
{
$db->query("START TRANSACTION");
$query="update orderInfo set info='".$arg_2."' where id='".$arg_1."'";
$result=$db->query($query);/*执行查询*/
if($result==false)
{
echo "could not update the orderInfo</br>".$db->error;
}
if($result )
{
$db->commit();
}
else
{
$db->rollback();
}
$db->query("end");
}
?》
《?php
echo "<form id='form1' name='form1' >";
echo "<table border=2 id='tab'>";
echo "<tr><th>订单序号</th><th>订单说明</th><th>备 注</th></tr>";
$num1=$result->num_rows; //返回查询的行数
while($num1)
{
$result_row=$result->fetch_row();
$str1=$result_row[0];
echo "<tr><td>";
echo $str1;
echo "</td><td>";
echo "</td><td>";
echo "<input type='text' name='sid' value='".$result_row[1]."' onblur='UpdateInfo(\'$str1,sid\')'>";
echo "</td><td>";
echo "</td><td>";
echo $result_row[2];
echo "</td></tr>";
$num1=$num1-1;
}
echo "</table>";
》
请问:该如何解决?