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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:15:12+00:00 2026-06-10T09:15:12+00:00

I am trying to update a field using a jEditable select. I am pulling

  • 0

I am trying to update a field using a jEditable select. I am pulling the data for the jEditable select from my database. The query array looks like this:

Array ([0] => Array([conference_id] => 1 [conference_name] => Allegheny Mountain) etc…

I want to show the conference name in the drop down but use the conference id as the value that gets inserted into the database. Currently all that I am getting is a blank list of select values. Does anybody have any ideas on how I can get this to do what I want?

Here is my code that I have below:

<?php
try {
    // Connect to the database
    $db = new PDO('mysql:host=localhost;dbname=football;', 'fbdbuser', 'fbdbpass');
} catch(PDOException $e) {
    echo $e->getMessage();
}
try {
    // Retrieve all team information
    $query = $db->prepare("SELECT * FROM team ORDER BY team_name");
    $query->execute();
    $result = $query->fetchAll(PDO::FETCH_ASSOC);
    // Retrieve all conferences
    $query_conference = $db->prepare("SELECT conference_id, conference_name FROM conference ORDER BY conference_name");
    $query_conference->execute();
    $result_conference = $query_conference->fetchAll(PDO::FETCH_ASSOC);
} catch(PDOException $e) {
    echo $e->getMessage();
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script src="js/jquery.js"></script>
    <script src="js/jeditable.js"></script>
    <script>
    $(document).ready(function() {
        $(".editable_conference").editable('update_conference.php', {
            data        : '<?php echo json_encode($result_conference); ?>',
            type        : 'select',
            indicator   : 'Saving...', 
            submit      : "OK", 
            tooltip     : "Click to Update" 
        });
    });
    </script>
    <title></title>
</head>
<body>
<h1 align="center">Update Teams Below</h1>
<?php //echo '<pre>' . print_r($result_conference) . '</pre>'; ?>
<table align="center" width="90%" border="1" cellpadding="5" cellspacing="0">
<tr bgcolor="#CCCCCC">
    <td>TEAM</td>
    <td>MASCOT</td>
    <td>STATE</td>
    <td>CONFERENCE</td>
    <td>DISTRICT</td>
    <td>CLASS</td>
</tr>
<?php foreach ($result as $value) { ?>
    <tr>
        <td><?php echo $value['team_name']; ?></td>
        <td class="editable_mascot" id="<?php echo $value['team_id']; ?>"><?php echo $value['team_conference']; ?></td>
        <td class="editable_state" id="<?php echo $value['team_id']; ?>"><?php echo $value['team_mascot']; ?></td>
        <td class="editable_conference" id="<?php echo $value['team_id']; ?>"><?php echo $value['team_state']; ?></td>
        <td class="editable_district" id="<?php echo $value['team_id']; ?>"><?php echo $value['team_district']; ?></td>
        <td class="editable_classification" id="<?php echo $value['team_id']; ?>"><?php echo $value['team_classification']; ?></td>
    </tr>
<?php } ?>
</table>
</body>
</html>
  • 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-10T09:15:13+00:00Added an answer on June 10, 2026 at 9:15 am

    You should understand the phenomenon of jeditable.

    You are using <?php echo json_encode($result_conference); ?> and this variable is multi-dimesional array. You can make it one dimensional and pass it data that works fine.

    $result_conference = $query_conference->fetchAll(PDO::FETCH_ASSOC);
    $conf = array();
    foreach($result_conference as $val){
        $conf[$val['conference_id']] = $val['conference_name'];
    }
    

    use $conf variable to instead of $result_conference

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

Sidebar

Related Questions

I'm trying to flip a bit field in SQL Server using an update query,
I am trying to update a field in a table with data from another
Im trying to update a database field without refreshing the page what im using
I was trying to update a record in the database using Object.update_attributes(:field => parameter)
I'm trying to update an NText field in SQL 2000 using Classic ASP. Here
I'm trying to update a field in the database to the sum of its
I have the following bunch of code trying to update a field using 2
I'm trying to update a database field to the current time, but can't pass
I am trying to update a field in my table using Netbeans and I
Possible Duplicate: Data not writing out to Database I'm trying to update a bit

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.