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 7278829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:55:43+00:00 2026-05-28T22:55:43+00:00

I have been trying to get right solution / answer for my issue, still

  • 0

I have been trying to get right solution / answer for my issue, still not able to get around, kindly help !

This is the same MYSQL UPDATE, LIMIT issue I was trying to resolve. I thought maybe with PHP and MYSQL script it should be able work, not sure, pl check the below code. It is updating Rate field in Ratemaster table with the last value of Rates table. But there are 3 rows in both the tables where 3 different rates in Rates table.

I have 2 tables: Ratemaster and rates, in which a CUSTOMER can have 1 PRODUCT with different RATES. Because of this, there is a duplication of customer and product fields, only the rate field changes.
Now Table Ratemaster has all the fields : id, cust_code, Product, Rate, user whereas Table Rates has only: id, cust_code, Rate, user. – user field is for checking session_user.

My php and mysql code below:

$con = mysql_connect("localhost","db","pwd");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("db", $con);

$user = $_SESSION['user'];

$query = "SELECT * FROM Rates";
$result = mysql_query($query)or die(mysql_error()); 

while ($line = mysql_fetch_assoc($result)) {
mysql_query("UPDATE Ratemaster, Rates SET Ratemaster.Rate = '".$line['Rate']."'  WHERE Ratemaster.user = '".$line['user']."'")or die(mysql_error());}
  • 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-28T22:55:44+00:00Added an answer on May 28, 2026 at 10:55 pm

    I have add one more field in Ratemaster called ‘rid’ . It’s should match with Rates table ‘id’ field. And one more thing, id always should be unique.

    Ratemaster has : 3 records

    (id:1, cust_code:1231, Product:Clay, Rate:0, user:user1,rid:1) 
    (id:2, cust_code:1231, Product:Clay, Rate:0, user:user1,rid:2) 
    (id:3, cust_code:1231, Product:Clay, Rate:0, user:user1,rid:3) 
    

    Rates has 3recs :

    (id:1, cust_code:1231, Rate:299, user:user1) 
    (id:2, cust_code:1231, Rate:355, user:user1) 
    (id:3, cust_code:1231, Rate:466, user:user1)
    

    Code :

     $con = mysql_connect("localhost","db","pwd");
     if (!$con)
        {
           die('Could not connect: ' . mysql_error());
        }
    mysql_select_db("db", $con);
    
    $user = $_SESSION['user'];
    
    mysql_query("UPDATE Ratemaster, Rates SET Ratemaster.Rate = Rates.Rate  WHERE Ratemaster.user = '".$line['user']."' AND Ratemaster.rid=Rates.id ")or die(mysql_error());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to get around this error for a day now and
I have been trying to get this one section of my UI to immediatly
I have been trying to days now to get this website completed ... however,
Been trying to find an answer to this but can't seem to get my
I have been trying to get it to work using this thread but can't
I have been trying to get more in to TDD. Currently keeping it simple
I have been trying to get yui-css grid system to make a three column
I have been trying to get nServiceBus to work with Ninject 2.0 as the
I have been trying to get LastBootUpTime using Win32_OperatingSystem class (WMI). HRESULT hr =
I have been trying all afternoon to get the jQuery Sifr Plugin ( http://jquery.thewikies.com/sifr/

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.