-1

我有这样的代码,用户从列表框中选择 field1 并单击提交以删除所选值的所有数据。

$sql = "delete from table where field1 = '$parameter' ;
mssql_query ($sql);

成功删除即提交后,我想显示类似“从表中删除 153 条记录”之类的文本

怎么做?

4

2 回答 2

3

使用mssql_rows_affected()

$sql = "delete from table where field1 = '$parameter' "; //added closing quotes
mssql_query ($sql);
echo "Deleted " . mssql_rows_affected($database_link) . " records from table."; //where `$database_link` is the variable that contains the `mssql_connect` statement
于 2012-08-24T17:24:41.680 回答
1

通过调用mssql_rows_affected

$sql = "delete from table where field1 = '$parameter'";
mssql_query ($sql);

echo 'Deleted ' . mssql_rows_affected($link) . ' row(s)';

$link您的数据库连接在哪里。

于 2012-08-24T17:25:23.617 回答