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

  • Home
  • SEARCH
  • 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 7007203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:34:37+00:00 2026-05-27T21:34:37+00:00

Whenever I execute an update-query, my whole table is updated. What do I have

  • 0

Whenever I execute an update-query, my whole table is updated. What do I have to do when I just want ONE value to be updated?

Here is my database structure:

ID   ||     photo     ||   sequence
1    ||   test.png    ||      1
2    ||   bla.png     ||      2

Whenever I execute this script,

if (isset($_POST['submitted'])) {
    $project = new Project();

    $project->sequence  = $_POST['sequence'][$key];
    $projectid          = $_POST['photoid'];

    if($project->updateProject($_DB, $projectid)) {
        $feedback = "OK";
    } else {
        $feedback = "NOT OK";
    }
}

Results in this:

ID   ||     photo     ||   sequence
1    ||               ||      4
2    ||               ||      2

So, what do I have to do to just update the sequence-value in the database without touching the rest of the data in the database…

FUNCTION:

public function updateProject($db, $id) {
        $sql = "UPDATE tblProject SET 
            sequence = '".$db->escape($this->sequence)."'
        WHERE id = '".$id."'";
        return $db->insert($sql);
    }

INSERT FUNCTION:

  public function insert($sql) {
    mysql_query($sql, $this->_connection);
    return mysql_affected_rows($this->_connection);
  }
  • 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-27T21:34:37+00:00Added an answer on May 27, 2026 at 9:34 pm

    There must be a problem with your $project->updateProject() function.

    Try with simple query:

    $qry = "UPDATE tblProject SET sequence = '".$project->sequence."' 
            WHERE ID =".(int)$projectid.";
    mysql_query($qry);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever a record is deleted or updated on a form, I want to save
I have to execute mulitple UPDATE queries for different parameters using a for loop.
I would like to have a UILocalNotification to execute an action whenever it gets
I have a bunch of SQL statements to execute on a database. (I'm doing
I have a series of files that I need to 'cat' whenever a one
* UPDATE * Here is what I found. Whenever I had that function in
I am trying to write an sql trigger that will update another table whenever
I'd like to execute some code whenever a (any!) message box (as spawned by
Can I create an event so I can execute some javascript whenever an element
Whenever I design a database, I always wonder if there is a best way

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.