0
所以我今天的問題是,如何從具有多個使用Php的JSON值的單個數據庫行獲取特定值。具有多個JSON值的數據庫行 - 如何獲得特定值
的數據已經擺在數據庫這樣:
a:7:{s:5:"cname";s:4:"enes";s:6:"cemail";s:22:"[email protected]";s:8:"caddress";s:18:"Florisvosstraat 56";s:4:"ctel";s:12:"+31685035990";s:9:"ccomments";s:5:"fdfsf";s:15:"wppizza-gateway";s:3:"cod";s:12:"wppizza_hash";s:64:"34e24d48186596cae445d52c5b0650d20c8a7c215ef1fe323ca6f09b7f804a8d";}
所以ofcourse我已經有代碼來這是如下數據庫得到這個。
<?php
header('content-type:application/json');
mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('depits');
$select = mysql_query("SELECT * FROM `test_json`");
$rows=array();
while($row=mysql_fetch_array($select))
{
$rows[] = $row;
}
echo json_encode($rows);
?>
我將如何能夠處理我收到的數據,並獲得例如,只有名稱和電子郵件的價值。如果這個含糊不清或者根本就不是一個好問題,請對其進行評論,以便爲了清晰起見我可能會更好。
真的很感激 –
其升技晚,但其實我是把一切都井然有序。你正在做的是單獨迴應價值,你是否有解決方案來打印好這些數字。 ($ rows = $ resultSet-> fetch_assoc()) { $ id = $ rows [/ code] {if}($ resultSet-> num_rows!= 0){ //將結果轉換爲數組 { –
} 'ID']; $ customer = $ rows ['customer_ini']; $ printed = $ rows ['printed']; if($ printed == 1){ \t $ printed =「Ja」; } else { \t $ printed =「Nee」; } print json_encode($ rows); echo「
顧客詳情:$ customer
」;「 } –Geprint:$ printed
DeletePrint