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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:57:41+00:00 2026-05-27T02:57:41+00:00

Editting a field in a table is becoming a headache for me as I

  • 0

Editting a field in a table is becoming a headache for me as I cannot figure out simple solutions. My cause of the problem is not being found by my eyes. The updating of the database function is not working.

Here is my PHP for viewproducts.php

<?php
    $result = mysql_query("SELECT * FROM products ")
                or die(mysql_error()); ;

    if (mysql_num_rows($result) == 0) {
        echo 'There Arent Any Products';
    } else {

        echo "<table border='1' width=100%><tr><th>Product Name</th><th>Description</th><th>Price</th><th>Image</th><th>Edit</th><th>Delete</th>";
        while($info = mysql_fetch_array($result))
        {
            echo "<tr>";
            echo "<td>" . $info['name']. "</td>";
            echo "<td>" . $info['description']. "</td>";
            echo "<td>£" .$info['price']." </td>";
            echo "<td>" . "<img src='../getImage.php?id=" . $info['serial'] ."'/></td>";

            echo '<td> <a href="edit.php?product_id=' . $info['serial'] . '">Edit</a></td>';
        }
    }
    echo "</tr>";
    echo "</table>";
?>

Here is my edit.php page:

<?php
    $id = $_GET['product_id'];
    $query = mysql_query("SELECT * FROM products WHERE serial = '$id'")
                or die(mysql_error());  

    while($info = mysql_fetch_array($query)) {
        echo "";

        $name = $info['name'];
        $description = $info['description'];
        $price = $info['price'];
        $picture = $info['picture'];
    }
?>

<form action="editsuccess.php" method="post">

Product ID:<br/>
<input type="text" value="<?php echo $id;?>" name="serial" disabled/>

<br/>

Name:<br/>
<input type="text" value="<?php echo $name;?>" name="name"/>

<br/>

Description:<br/>
<input type="text" value="<?php echo $description;?>" name="description"/>

<br/>

Price:<br/>
<input type="text" value="<?php echo $price;?>" name="price"/>

<br/>

Picture:<br/>
<? echo'<img src="../getImage.php?id=' . $info['serial'] .'"/>'?>

</br>

<input type="submit" value="Update Product"/>

</form>

And finally here is my editsuccess.php page:

<?php
    session_start();
    require_once '../includes/db.php';  
    $id = $_REQUEST['product_id'];

    $name = $_POST['name'];
    $description = $_POST['description'];
    $price = $_POST['price'];

    $info = "UPDATE products SET name='$name', description ='$description', price ='$price' WHERE serial ='$id'";

    mysql_query($info) or die ("Error: ".mysql_error());

    echo "Database updated.";

?>

Any help guys?

  • 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-27T02:57:42+00:00Added an answer on May 27, 2026 at 2:57 am

    It looks like you’re not passing product_id to your editsuccess.php page. Try changing the first line of your <form> declaration in edit.php to:

    <form action="editsuccess.php?product_id=<?php echo $id; ?>" method="post">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text field (flash.display.textField) for editing, but the default font does not
My table field names are lowercase and the field names I get from CSV
I have a table called Field in my SQL Server database. The table has
I need to make my form field not required when uploading information. Here is
I have a table view with two rows, each with a text field. One
So I've been working on this all day and I can't figure out how
Possible Duplicate: Table View scroll when text field begin editing iphone I have loaded
I have a text field cell in a table view, from which I need
I have a marital status field in my users table that its just varchar
I have made an entry field required somehow but I'm not sure how. When

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.