在PHP中删除数据库记录[菜人问题]

bacp 2003-08-31 10:48:01


在MYSQL中可以如此删除
mysql>use bacp
database changed
mysql> delete from news where new_id=001
删除成功

mysql_query("delete from news where new_id=$new_no"
or err_output("删除错误!";

这里操作出错,有哪位高手告诉我错在哪里吗?
$arrNews["new_id"]这个数组,也可以得到new_id变量
...全文
67 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
DFlyingchen 2003-08-31
  • 打赏
  • 举报
回复
mysql_select_db("bacp");
mysql_query("delete from news where new_id=$new_no");
DFlyingchen 2003-08-31
  • 打赏
  • 举报
回复
用这条语句:
mysql_db_query("bacp", "delete from news where new_id=$new_no"
or err_output("删除错误!";
看看能不能用
bacp 2003-08-31
  • 打赏
  • 举报
回复
有金山翻译了N久才看明白~````

我确信连接到数据库
bacp 2003-08-31
  • 打赏
  • 举报
回复
说中文好不~~~~``

看不明白
DFlyingchen 2003-08-31
  • 打赏
  • 举报
回复
you can try:
mysql_db_query("bacp", "delete from news where new_id=$new_no"
or err_output("删除错误!";

and first make sure that the Mysql database is connected.

PS:
mysql_db_query
(PHP 3, PHP 4 )

mysql_db_query -- Send a MySQL query
Description
resource mysql_db_query ( string database, string query [, resource link_identifier])


Returns a positive MySQL result resource to the query result, or FALSE on error.

mysql_db_query() selects a database and executes a query on it. If the optional link identifier isn't specified, the function will try to find an open link to the MySQL server and if no such link is found it'll try to create one as if mysql_connect() was called with no arguments.

See also mysql_connect() and mysql_query().


Note: This function has been deprecated since PHP 4.0.6. Do not use this function. Use mysql_select_db() and mysql_query() instead.

missboy 2003-08-31
  • 打赏
  • 举报
回复

mysql_query("delete from news where new_id=$new_no") or die("删除错误!)";

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧