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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:27:34+00:00 2026-06-01T21:27:34+00:00

Okay, I’m horrendously new to MySQL and PHP, but could use some help here.

  • 0

Okay, I’m horrendously new to MySQL and PHP, but could use some help here.

Grand vision: a big page full of editable fields (I’m using Jeditable, an edit-in-place jquery plugin) that stores values to different fields in the same row of a MySQL database.

I’m totally lost on how to properly post the values to different fields of the MySQL database, though. What I have is below; it’s derived from the examples Jeditable provides. I can enter data into the fields, but it saves the ID of the field – not the data – and it appends it into multiple columns of my database, not the one correct column.

So, in short – how would I map what you see here to different locations in my MySQL database (example: one line item/record with a customer name value, a size value, an MRR at initial sale value, etc?)

Here is my HTML-

<!-- JQuery to extract form data... -->
  <script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
      $('#paragraph_1').editable('save.php');
    });

    $(document).ready(function() {
      $('#custsize').editable('save.php');
    });

    $(document).ready(function() {
      $('#mrratsale').editable('save.php');
    });
  </script>

<!-- my form fields... -->
<h2 id="paragraph_1" name="paragraph_1"></h2>
<h3 id="custsize" name="custsize"></h3>
<h3 id="mrratsale" name="mrratsale"></h3>

…and here is my save.php file…

   <?php
      require_once 'config.php';
      $query=sprintf("INSERT INTO customerdata (ListItemID, CustName, CustSize, MrrAtSale)
        VALUES (%d, '%s', '%s', '%s')",
         $id, $_POST['id'], $_POST['id'], $_POST['id'], stripslashes($_POST['value']));

      $dbh->exec($query);
       /* What is echoed back will be shown in webpage after editing.*/
         print $_POST['value']; 
     ?>

Any help at all would be much, much, much appreciated (and try not to laugh!)

  • 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-01T21:27:35+00:00Added an answer on June 1, 2026 at 9:27 pm

    What you have to do is target each editable database write to its own function – so you can target individual fields.

    So your html files should read (I also cleaned up your JS):

    <!-- JQuery to extract form data... -->
    <script type="text/javascript" charset="utf-8">
      $(document).ready(function() {
        $('.paragraph_1').editable('save.php?type=paragraph');
        $('.custsize').editable('save.php?type=custsize');
        $('.mrratsale').editable('save.php?type=mrratsale');
      });
    </script>
    
    <!-- my form fields... -->
    <h2 id="1" class="paragraph_1"></h2>
    <h3 id="1" class="custsize"></h3>
    <h3 id="1" class="mrratsale"></h3>
    

    Notice how I added query strings to the save.php file. You should also change the elements’ id to a field in the record, so you can update the correct record.

    The php file:

    <?php
      require_once 'config.php';
    
      $type = (isset($_GET['type'])) ? $_GET['type'] : "";
      $value = (isset($_POST['value'])) ? $_POST['value'] : ""; //value posted
      $id = (isset($_POST['id'])) ? $_POST['id'] : ""; //id of the element
    
      if($type == "paragraph") {
        mysql_query("UPDATE customerdata SET paragraph='$value' WHERE id='$id'");
      } elseif ($type == "custsize") {
        mysql_query("UPDATE customerdata SET CustSize='$value' WHERE id='$id'");
      } elseif ($type == "mrratsale") {
        mysql_query("UPDATE customerdata SET MrRatSale='$value' WHERE id='$id'");
      };
    
       print $value; 
    ?>
    

    You should add some validation and clean the data before putting it in the database but this should get the jEditable working.

    Note that you should probably update the record rather than inserting it otherwise you will be creating a new record everytime the data is editted.

    You can see the id is used to update the correct record.

    I haven’t really used jEditable recently but this should get you started.

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

Sidebar

Related Questions

Okay so im working on this php image upload system but for some reason
Okay, so this is a long long shot but here it goes... When IE
Okay, here's the rundown. I'm developing a video hosting site with PHP and jQuery
Okay, I have setup up a handler for a div click but for some
Okay, so the answer to my question might not be the problem but here's
Okay i know i have to use the JDBC etc, but im not sure
Okay I got some good advice for Mobile Detection but still having an issue
Okay, first some background, I can't use any javascript library except YUI for this
Okay, so this should be a simple question, but I'm fairly new at programming,
Okay, here is what I have going on. Some background: I'm making changes to

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.