I have 2 tables:
Table1:** NAME (id, Slno, name, phone, city, state, user, rid)
Table2:** NAMES2 (id, name, phone, city)
In Table1 there are duplicate records, so In Table1 the 'rid' field is capturing Table2.id, to have the difference in data.
I want to update 'Slno' field with increment starting from 1 to n for every login user (fieldname is user)
I have mysql and php file where i have the below statement which is not working.
my PHP file:
$usr=$_SESSION['user'];
$j=0;
mysql_query("UPDATE NAME, NAMES2 SET NAME.SLno='$j++' WHERE NAME.rid=NAMES2.id && NAME.user='$usr'");