如何检查查询是否执行 [英] How to check whether query executed or not

查看:94
本文介绍了如何检查查询是否执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个表单!有

三个文本框


旧密码

新密码

确认新密码!!



它正在通过javascript验证,具有以下功能

展开 | 选择 | 换行 | 行号

解决方案

向我们展示你的尝试。


当你想用 UPDATE 查询,你应该使用 mysql_affected_rows 功能。人们经常错误地使用 mysql_num_rows 函数,但该函数只计算行数返回 UPDATE 查询永远不会返回任何行。


我在表中只有一行简单


你能说出mysql受影响的行函数的返回类型是什么吗?


可以这样做吗


展开 | 选择 | Wrap | 行号


引用手册(我之前发布的链接

意思是,如果你期望查询影响一行,你会检查函数是否返回1.如果没有,那么查询没有按预期工作

i had created a form ! having
three text box

Old password
New password
Confim new password!!


it is being validated by javascript with the following fuction

Expand|Select|Wrap|Line Numbers

解决方案

Show us what you tried.

When you want to check how many rows were successfully updated with an UPDATE query, you should use the mysql_affected_rows function. People often mistakenly use the mysql_num_rows function, but that function only counts the number of rows returned, and an UPDATE query never returns any rows.


i have only 1 row in the table simply

can u tell what would be the return type of the mysql affected rows function ?

can it be done like this


Expand|Select|Wrap|Line Numbers


To quote the manual (the link I posted earlier
Meaning, if you are expecting the query to affect one row, you would check to see if the function returns 1. If it does not then the query did not work as expected.


这篇关于如何检查查询是否执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆