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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:32:13+00:00 2026-06-16T00:32:13+00:00

UPDATE data from db to user to db through an input field. Can anyone

  • 0

UPDATE data from db to user to db through an input field.
Can anyone please tell me whats wrong with this UPDATE.
I’m getting the data from a field where I’m also writing from db, is that not possible?

My sql code looks like this..

<?php session_start(); $brugerID = $_SESSION['brugerID']; $holdID = $_SESSION['holdID']; ?>

My php code looks like this:

<form method="POST" action="" id="submitvaegt">
    <tr>
        <td colspan="5"><h2>Hvor meget vejer du idag?</h2></td>
    </tr>
        <?php
        $brugerensID = $_SESSION['brugerID'];
        $sql = "SELECT * FROM `brugere` 
        WHERE brugerID = '$brugerensID'";
        $result = mysql_query($sql);
        $row = mysql_fetch_assoc($result);

        echo '<tr>';
        echo '<td rowspan="3" valign="middle" width="128">';
        echo '<img src="http://www.mahogni.com/afs/wp-content/uploads/2012/12/weight.png" width="60"></td>';
        echo '<td>&nbsp;</td>';
        echo '<td colspan="3">&nbsp;</td>';
        echo '</tr>';

        echo '<tr>';
        echo '<td width="245" height="35">Jeg vejer i dag</td>'; //vaegtnu
        echo '<td width="280">';
        echo '<input class="textboxReport" type="text" name="vaegtnu" size="3" value="';
        if ($row['vaegtnu']==0) 
        { 
            echo $row['vaegtstart'];
        } 
        else 
        {
            echo $row['vaegtnu'];
        }           
        echo '"/>&nbsp;kg&nbsp;&nbsp;';
        echo '<input type="submit" name="submitvaegt" id="submitvaegt" value="GEM" />';
        echo '<td width="280" height="35">Jeg har til nu tabt</td>'; //vaegtstart - vaegtnu
        echo '<td align="right">';
        if ($row['vaegtnu']==0) 
        { 
            echo $row['vaegtstart']-$row['vaegtstart'];
        } 
        else 
        {
            echo $row['vaegtstart']-$row['vaegtnu'];
        }           
        echo '&nbsp;kg</td>';               
        echo ' </tr>';

        echo '<tr>';
        echo '<td height="35">Mit mål er</td>'; //vaegtslut
        echo '<td>'. $row['vaegtslut'] . '&nbsp;kg</td>'; 
        echo '<td height="28">Jeg mangler at tabe</td>'; //vaegtslut - vaegtnu ELLER vaegtslut - vaegtstart
        echo '<td>';

        if ($row['vaegtnu']==0) 
        { 
            echo $row['vaegtslut']-$row['vaegtstart'] . '&nbsp;kg';
        } 
        else 
        {
            echo $row['vaegtslut']-$row['vaegtnu'] . '&nbsp;kg';
        }
        echo '</td>';
        echo '</tr>';
        ?>
</form>
  • 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-06-16T00:32:14+00:00Added an answer on June 16, 2026 at 12:32 am

    Can you try this:

    $vaegtnu=$_POST['vaegtnu'];
    
    $brugerensID= $_SESSION['brugerID'];
    
    mysql_query("UPDATE `brugere` SET vaegtnu='$vaegtnu' WHERE brugerID='$brugerensID'");
    

    And tell me if it helps.

    Also check that your variables match, i.e. in XXXX = $_POST['YYYY'] YYYY should be the name of the input, and XXXX should be the name of the variable you’re using in the query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I update a complete data row by using a data row from
I am trying to update a field in a table with data from another
I have this code to update my SQL database from data in a textbox,
I'm creating a simple back-end app through which the user can create/update/delete database rows
I have a manager class, which update json data from web, get values... The
I have 2 worksheets, I need to update with data from another worksheet I
I am using prepared statements to store, retrieve and update data to or from
I am trying to update table A with data from table B. I thought
I am using OLEDB to Update data in .dbf database from c#. I get
Android 2.1 update 1 Eclipse 3.5 I have a problem reading data from my

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.