Hello!
I was preparing to give a mobile database interface.
How can I spit out a list-data in the returned data from mysql?
Thank you in advance for your help!
Most ez a forráskód:
<!DOCTYPE html>
<html>
<body>
<div class="easyui-navpanel" style="position:relative;padding:20px">
<header>
<div class="m-toolbar">
<div>
<input class="easyui-datebox" name='d' id='d' prompt="Dátum" data-options="editable:false,panelWidth:220,panelHeight:240,iconWidth:30" style="width:100%">
</div>
</div>
</header>
<ul class="easyui-datalist" data-options="
fit: true,
lines: true,
url: 'sql_address.php',
method: 'get',
border: false,
textFormatter: function(value){
return '<a href\'javascript:void(0)\' class=\'datalist-link\'>' + value + '</a>';
},
onClickRow: function(index,row){
$('#p2-title').html(row.addr);
$.mobile.go('#p2');
}
">
</ul>
</div>
<style scoped>
form label{
display: block;
margin: 10px 0 5px 0;
}
</style>
</body>
</html>
<?php
include 'conn.php';
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET utf8 ");
//$act_date = mysql_real_escape_string($_REQUEST['d']);
$act_date = $_POST['d'];
$query = "SELECT address.efi_address AS name, work_types.name AS n, address.ml_num AS ml FROM walker4.address";
$query .= "LEFT JOIN tchs ON tchs.id = address.tch";
$query .= "LEFT JOIN work_types ON work_types.id = address.work_type";
//$query .= "WHERE address.works_date =";
//$query .= $act_date;
$rs = mysql_query($query);
$items = array();
while($row = mysql_fetch_object($rs)){
array_push($items, $row);
}
$result["rows"] = $items;
echo json_encode($result);
?>