Bluehost.com Web Hosting $6.95

Re: [PHP] mysql_error() problem?

This is a discussion on Re: [PHP] mysql_error() problem? within the PHP General forums, part of the PHP Programming Forums category; From: "Tyler Longren" <tyler@jdhost.com> > I'm running an UPDATE query on my table. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-06-2003
Cpt John W. Holmes
 
Posts: n/a
Default Re: [PHP] mysql_error() problem?

From: "Tyler Longren" <tyler@jdhost.com>
> I'm running an UPDATE query on my table. After executing the query, I

check
> mysql_error() to see if there's any errors:
> if (mysql_error() == "") {
> // success
> }
> else {
> // failure
> }
>
> mysql_error() is always empty even if the query didn't succeed. So it
> always thinks it succeeds. I remember having this problem once quite a
> while ago. I remember somebody telling me that it had something to do

with
> UPDATE. Is there a better way to check for errors?


Please define "didn't succeed"... There is a difference between the query
"generated an error" which is caught with mysql_error() and the query "did
not affect any rows" which is caught by mysql_affected_rows().

---John Holmes...

Reply With Quote
  #2 (permalink)  
Old 08-06-2003
Curt Zirzow
 
Posts: n/a
Default Re: [PHP] mysql_error() problem?

* Thus wrote Tyler Longren (tyler@jdhost.com):
> hmmm...perhaps that was it. When I had this issue before, someone told me
> to check mysql_affected_rows() when using issuing an UPDATE query. I'll
> give that a shot.


Correct, mysql_affected_rows() on a query that doesn't return rows
(insert, update, delete) and use mysql_num_rows() for a select query.


Curt
--
"I used to think I was indecisive, but now I'm not so sure."
Reply With Quote
  #3 (permalink)  
Old 08-06-2003
Andu
 
Posts: n/a
Default RE: [PHP] Stop neurotic posting


--On Wednesday, August 06, 2003 13:11:52 -0700 "Chris W. Parker"
<cparker@swatgear.com> wrote:

> Aside from the fact that $example1 != $example2, they are different in
> ATTITUDE.
>


Which was the original issue of this thread. Seems like few (with a
temporary advantage of knowledge) would consider not to have an attitude
(don't like to answer, don't do it) and if there is a choice, the nasty one
seems to prevail. I guess it's a reflection of the times/place we are
living or a huge lack of imagination.
My last word on this...


Andu
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:48 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0