Jump to content

mysql_affected_rows,mysql_info()


janim

Recommended Posts

Hi guys

how can i know what attributes has been modified after mysql_query ?

let's say i have this table

id name email password

1  aa      @    ****

2  bb      @    ****

3  cc      @    ****

4  dd      @    ****

and i updated it :

mysql_query("update table set name = '$name',email='$mail',password='$pas' where id='2'");

so how can i know wich attributes has been modified ?

i.e which ones has been changed ?

,let's suppose the new data is : cc ,@,**** .

so just name has been changed ! see?

how can i know this dynamically

mysql_affected_rows return the number of fields and so on mysql_info();

any comment are welcome , thanks

Link to comment
https://forums.phpfreaks.com/topic/104656-mysql_affected_rowsmysql_info/
Share on other sites

I don't think you can with the query. As far as MySQL is concerned, you are overwriting all the values. You could do a compare with PHP first. That would involve selecting the values, using strcmp() to see what has changed, then writing the ones that have.

Doesn't he want to see which fields were updated in the database? If so, he selects the database before updating, compares the db value with the submitted value, which shows him which fields are going to be updated. Then run the update. Or am I not understanding?

yes...that is what i said before...i read your other post as something different then the above

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.