i'm very beginner to android programming. and i have some problem that makes me feel confused.
my problem is i want to show list of data on the listview from a table of mysql database. i've been trying to follow this tutorial http://coenraets.org/blog/2011/10/sample-application-with-jquery-mobile-and-phonegap/ and modified to suitable with my program. but my code didn't show the data from my database.
please help me. thanks
this is some of my code this is my html code
<ol id="top10list" data-role="listview" data-theme="a"> </ol>
and this is my php code
<?php
include 'config.php';
$sql = "select m.namamovie, m.description from top10 t left outer join movie m on t.idmovie = m.idmovie";
try {
$dbh = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $dbh->prepare($sql);
$stmt->bindParam("idtop10", $_GET[idtop10]);
$stmt->execute();
$top10 = $stmt->fetchObject();
$dbh = null;
echo '{"item":'. json_encode($top10) .'}';
} catch(PDOException $e) {
echo '{"error":{"text":'. $e->getMessage() .'}}';
}
?>
and this is my javascript code
var serviceUrl ="..\MovieManiac1.0\assets\www\";
var top10s;
$('#top10list').bind('pageinit', function(event) {
getTop10List();
});
function getTop10List() {
$.getJSON(serviceURL + 'gettop10.php', function(data) {
$('#top10list li').remove();
top10s = data.items;
$.each(top10s, function(index, top10) {
$('#top10list').append('<li><a href="top10.php?id=' + top10.idmovie + '">' + '<h4>' + movie.moviename + '</h4>' + '<p>' + movie.moviename + '</p>' + '<p>' + movie.description + '</p>'+ '</a></li>');
$('#top10list').listview('refresh');
});
}
}