Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7516347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:06:02+00:00 2026-05-30T01:06:02+00:00

I have 2 tables: Table1:** NAME (id, Slno, name, phone, city, state, user, rid)

  • 0

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'");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:06:04+00:00Added an answer on May 30, 2026 at 1:06 am

    If i have correctly understand, you need somthing like that:

      $j=0;
      $query=mysql_query("SELECT id FROM NAMES2");
      while($res=mysql_fetch_array($query))
      {
      ++$j;
      mysql_query("UPDATE NAME SET SIno='$j' WHERE rid='$res[id]'");
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have two different tables table1 - property ================= id,name, address, city state, zip
actually i have 2 tables table1 and table2 table1 name city addr. table2 name
I have 2 tables as follow : table1 has these fields: year,day,month,name table2 has
I have 2 tables Table1 with columns [BId,Name,Amount] Table2 with columns [CId,BId, ExpenseType,Expense]. BId
I have 2 tables: Table1 ID-NAME 1-Name1 2-Name2 Table2 ID-NAME 1-Name3 4-Name4 I want
I have two tables: Table1: id attr1 fk1(Table2) fk2(Table2) Table2: id name I want
I have two tables table1 = records, table2 = duplicates. Both tables contain a
I have 3 tables: table1 with columns(ProductId, name, etc), table2 (DocumentId, name, etc), table3
I have two tables table1: { id, name } table2: { id, table1_id, time_added
I have a mysql database with two tables: table1 (id, name, emailid) table2 (id,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.