PHPMyAdmin에서 데이터를 검색하고 피커 변경에 데이터를 표시하려고합니다. 여기 내 코드는 입니다. var currentWin = Ti.UI.currentWindow; 내가 선택기를 변경할 때 다음JSON 구문 분석을 사용하는 티타늄
var sendit = Ti.Network.createHTTPClient();
sendit.open('GET', 'http://localhost/mobileapp/productread.php');
sendit.send();
sendit.onload = function(){
var json = JSON.parse(this.responseText);
var json = json.mobile_product;
var picker = Ti.UI.createPicker();
// turn on the selection indicator (off by default)
picker.selectionIndicator = true;
var data = [];
var pos;
data.push (Ti.UI.createPickerRow({title:''+ json[pos].product_name + '',custom_item:'b'}));
}
picker.add(data);
currentWin.add(picker);
//var rw = db.execute("SELECT product_name, SUM(product_quantity)FROM mobile_product GROUP BY product_name");
picker.addEventListener('change', function(e){
var sendit = Ti.Network.createHTTPClient();
sendit.open('GET', 'http://localhost/mobileapp/orderread.php');
sendit.send();
sendit.onload = function(){
var json = JSON.parse(this.responseText);
var json = json.mobile_product;
var pos;
var product_name = json[e.rowIndex];
for (pos=0; pos < json.length; pos++) {
alert(''+json[pos].orders + '');
}
}
})
}
은 경고 내가 옆에있는 선택기를 변경하면 다시 경고는 모든 datas 나타납니다 ... 하나의 변화에 대한 열의 모든 값 (주문)로 나타납니다 예를 들어 열 (순서)에 10 개의 값이 있고 피커 밸러스를 변경하면 10 개의 값으로 10 회 나타납니다. 다음과 같이 열의 값을 표시하고 싶습니다. 피커의 변경 .... 피커에 대한 PHPMyAdmin에서 데이터 (product_name)를 검색했습니다 ... 피커를 변경할 때 해당 특정 이름의 값을 표시하고 싶습니다 .... 쿼리 SELECT SUM (product_quantity) FROM mobile_pro 덕트 그룹은 PHP 파일에서 제품 _ 에 의해 .. 내 PHP 파일
<?php
//cust-mysql-123-04
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('Not connected : ' . mysql_error());
}
// make foo the current db
$db_selected = mysql_select_db('mobileapp', $link);
if (!$db_selected) {
die ('Can\'t use : ' . mysql_error());
}
// Set the default namespace to utf8
mysql_query("SET NAMES 'utf8'");
if($result = mysql_query("SELECT SUM(product_quantity) As orders FROM mobile_product GROUP BY product_name")) {
//echo mysql_num_rows($result);
while ($row=mysql_fetch_array($result)) {
// $json.= "<li>".$row['first_name']."</li>";
$json[]=array(
'orders'=>$row['orders']
);
}
}
echo json_encode(array('mobile_product' => $json));
mysql_close();
?>
은 어떤 사람이 나를 도울 수 있습니까? ?? – user1562991