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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:45:37+00:00 2026-05-31T22:45:37+00:00

I have been trying to extract data from a database and fill in a

  • 0

I have been trying to extract data from a database and fill in a drop down list generated by JavaScript. However the PHP code doesn’t seem to work at all.
Here is the snippet code I am working with:

<script type="text/javascript">
    $(document).ready( function () {$('#mainTable').dataTable({}).makeEditable({
   "aoColumns": [
{
    indicator: 'Saving Items...',
    tooltip: 'Click to select Items',
    loadtext: 'loading...',
    type: 'select',
    onblur: 'submit',
    <?php
        $item_set = get_all_items();
    while($item = mysql_fetch_array($item_set)){
      ?>
       data: "{'0':'Please select...', '1':'A'+' <? echo $item["item_desc"] ?> '}",
    <?php
        }
    ?>
      sUpdateURL: function(value, settings){
   alert("Custom function for posting       results");
   return value;
 }
 },                 
 {
 }
 ]
 });
} );
</script>

I have tried the code in a simple HTML form and it works just fine. Btw I am using jQuery editable datatable
http://code.google.com/p/jquery-datatables-editable/wiki/Overview

I just want to populate the select menu with data from the database. Any help is appreciated.

Here is the generated page:
I the first column of the table, the drop down list must also have item description from DB.

  • 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-31T22:45:38+00:00Added an answer on May 31, 2026 at 10:45 pm

    View your HTML source. You’ll see that you have multiple data lines. Use json_encode to convert an array to Json instead of trying to string it together.

    <?php
        $item_set = get_all_items();
        while($item = mysql_fetch_array($item_set)){
            $items[] = $item['item_desc'];
        }
    ?>
    

    data: <?php echo json_encode($items); ?>,
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to extract numeric data from a database where the columns have
I'm trying to serialize objects from a database that have been retrieved with Hibernate,
I have been going round in circles trying to extract meta tag information from
I'm trying to extract data from a MySQL server with PHP. The information has
In PHP I am having difficulty trying to extract row data from one SQL
I'm trying to extract data from a many to many table configuration. I'm sorry
I have been using XPath with scrapy to extract text from html tags online,
We have an architecture where we use SSIS to extract data from XML batch
I am trying to extract some data from an XML input with 6 lines,
I am trying the create a loop to extract data from an array created

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.