Re: [PHP-DB] mysql_affected_rows() question: what was changed?

2003-03-20 Thread Edwin Boersma
Not really true, unless I learned programming in a different way ;-)

I mean, if I send an update query, like update table set 
field1=$nfield1, field2=$nfield2 ..., I don't know WHICH fields have 
changed. mysql_affected_rows() only reports how many records were 
changed. So, if I want to know which fields have changed, I should check 
it before I send the query? Seems like a lot of work extra...

Cpt John W. Holmes wrote:
Is there a function to show WHAT fields were changed in the records,
instead of only how many records were changed (with
mysql_affected_rows())?

I would like to report to the user which fields were altered, e.g. if he
would change his phone number, to tell him: phone number changed to
..

Ummm... you're creating the SQL, you should know what was updated, right?
There's no function that's going to tell you this, so keep track of it as
you create your query.
---John Holmes...



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] mysql_affected_rows() question: what was changed?

2003-03-20 Thread John W. Holmes
 I mean, if I send an update query, like update table set
 field1=$nfield1, field2=$nfield2 ..., I don't know WHICH fields have
 changed. mysql_affected_rows() only reports how many records were
 changed. So, if I want to know which fields have changed, I should
check
 it before I send the query? Seems like a lot of work extra...

Well, that's the only way to do it. If you want to know what changed,
SELECT it out first and compare. UPDATE commands do not return that
information, plain and simple. Worrying about it is a waste of time.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php