Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing changes to tables

Status
Not open for further replies.

adam525

ISP
Aug 27, 2003
7
US
I'm working on an application that someone else wrote (using PHP and MySQL).

There are LOTS of queries that make changes to different tables with joins and it's really hard to track down what's been done to the data after running the code.

I've been trying to check some of the changes with mysql_affected_rows (for updates) and I've tried that function every way I can think of and I can't get that function to work.

I resorted to using a counter and just counting the number of times that a while loop runs to sort of get an idea of how many records _might_ have been touched.

That has (obviously) turned out to be unreliable.

Does anyone know of a tool (or method) to show changes to a mysql DB after running a query? I looked at mysql diff, but it just looks at structure changes. I need to know how many records were touched when this code was run and I've been working on this for quite sometime and I'm not getting anywhere.

Does anyone have any ideas?

Thanks very much in advance,

Adam
 
mysql_affected_rows should have told you how many rows where affected when the query was run.

How did you attempt to use mysql_affected_rows?

You might want to ask over at the PHP forum for more specific ways of obtaining the affected rows from PHP.

forum434

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
What I've done is store the curernt values in hidden fields in the php page when the page is loaded. When the page is posted, store those hidden fields in one array and the new fields (what they look like now) in another. Use $newarray=array_diff($array1,$array2) to find the differences.

I'm not sure how or if you could do it through MySQL alone.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top