PDA

View Full Version : mysql affected rows info


o0O0o.o0O0o
05-06-2008, 03:10 AM
hi ,


i have a php page


1) First it executes the the query 1
2) then there is a function which gets executed which inserst some data in database


If i use mysql_affected_rows which result it show of query 1 or query which wa done by function

Fumigator
05-06-2008, 05:14 AM
From the manual:

Get the number of affected rows by the last INSERT, UPDATE, REPLACE or DELETE query associated with link_identifier .

So I guess my answer is, the last query that was run, whether it's inside a function or not.

o0O0o.o0O0o
05-06-2008, 07:58 AM
what is the difference between this last query or any user on my website has executed some query before that

Fumigator
05-06-2008, 04:25 PM
I'm going to try to pretend I understood your question... each user owns a connection to your database for the duration of thr script and MySQL keeps each connection separate so any other user's queries are irrelevant to a particular user's insert/update/delete and the mysql_affected_rows() function that is run immediately following an insert/update/delete query.

o0O0o.o0O0o
05-07-2008, 05:01 AM
i have

1) 1 database include file
2) one include functions file like (add notes for that customer)


Now when i execute the php file

$qry = Insert into Utah where name = "Fumigator"
$result = mysql_query ($thoqry)



addnotes (id ,"Fumi is a good man");
so mysql_affected_rows() will return success of notes query

It means sql has identifiers for each script and each user . so no matter how many users executes this same scpipt , the affected rows will be mine current.

Is it possible to get more detail of how SQL uses identifiers?