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

  • Home
  • SEARCH
  • 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 6375999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:41:17+00:00 2026-05-25T01:41:17+00:00

I’m trying to make a mobile application using jQuery Mobile and Phonegap. But first

  • 0

I’m trying to make a mobile application using jQuery Mobile and Phonegap. But first of all I’d like to say that I’m not a professional programmer; I’m only a student trying to understand de basics of a mobile application. I do have some experience in HTML and PHP.
So I’m trying to learn myself some of the basics of a mobile application; I tried it before but due to a lack off time I did not have the time to investigate the problem I was experiencing back then.

The thing I’m trying to realize is quite simple:
I have a SQL database with: names (1), where they work(2) and a description(3). All of them have an unique ID – So 4 tables.
First thing I’d like to pull from the database is their names according from where they work.

I tried to follow several tutorials, guides and read trough some other stuff. This is what I came up with. This is a PHP-file placed on the server.

  <?

include 'includes/db.php';

$sql = mysql_query("SELECT name FROM work");

$array = Array();


if(mysql_num_rows($sql) > 0)
{
    for($i=0; $i < count($sql); $i++){
         $rec = mysql_fetch_assoc($sql);
        $array[name] = $rec['name'];                   
    }

    echo json_encode($array);
}

?>

When I open this PHP-file I do get a result back from the database, formatted in JSON. But I’m only getting one name in return while there are more names in that database.

Next I’d go and place the jQuery code in the jQuery-Mobile app like this:

<script type="text/javascript">
        $(document).ready(function(){

            $.getJSON('names.php', function(data){
                $("#namesDiv").html(data);

            });

        });
</script>

Ofcourse this is not returning anything; this I’m still trying to figure out how to display all the names as a list in the HTML file.
But after this I want to be able to tap on a name from that list and get the description from that person on a next page. I know in PHP you can get the ID from the URL (page.php?id=1) and then pass it on in your query to get the correct data; but how can this be done when JSON is handeling everything?

I hope someone can help me out; I know I’m asking a lot and that my knowledge is maybe insufficient but I would really appreciate any help I can get.

  • 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-25T01:41:18+00:00Added an answer on May 25, 2026 at 1:41 am
    jQuery.getJSON( url, [data], [success(data, textStatus, jqXHR)] )
    
    url: A string containing the URL to which the request is sent.
    
    data: A map or string that is sent to the server with the request.
    
    success: (data, textStatus, jqXHR)A callback function that is executed if the request succeeds.
    

    you can send id like

    $.getJSON("names.php",{id:id)},function(json){
    
    //do what ever you want with json
    
    });
    

    and in your names.php do

    $id=$_GET['id'];
    

    query part

    $temp = array();
    $sql = mysql_query("SELECT name FROM work"); 
    
    while ($row = mysql_fetch_assoc($sql)) {
    
    if(empty($temp))
       $temp=array($row['name ']);
    else    
       array_push($temp,$row['name ']);    
    }
    echo (json_encode($temp));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and

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.