我正在使用此代码向数据库添加值
<?php
$debdes = $_POST['debdes'];
$debamt = $_POST['debamt'];
$crdes = $_POST['crdes'];
$cramt = $_POST['cramt'];
$date = $_POST['date'];
include_once ("db.php");
$ucbook = "INSERT INTO cbook(debdes,debamt,crdes,cramt,date) VALUES ('$debdes','$debamt','$crdes','$cramt','$date');";
if (mysql_query($ucbook))
echo "One Record Updated Successfully with the following details <br/>";
else
echo mysql_error();
?>
现在我希望在查询传递时告诉我显示哪些值是这样添加的
“以下记录已成功更新
debamt = 1000 debdes = test
结束“
答案 0 :(得分:0)
有两种方法可以做到:
auto_increment
自动生成的,请使用mysql_insert_id。干杯,
JRH
答案 1 :(得分:0)
如果查询未失败,您只需显示您的值:
.
.
.
if (mysql_query($ucbook)){
echo "One Record Updated Successfully with the following details <br/>";
echo "debdes=$debdes <br>" ;
echo "debamt=$debamt <br>" ;
echo "crdes=$crdes <br>" ;
echo "cramt=$cramt <br>" ;
echo "date=$date <br>" ;
echo "end";
}
else
{
echo "Error while inserting data :".mysql_error()."<br/>";
}
.
.
.