У меня простая mysql_query
и я хотел бы закодировать results(title= > $title, price => $price etc)
В json.
$ sql = mysql_query ("SELECT * FROM item_details WHERE posting_id = '$ item_number'"); while ($ row = mysql_fetch_array ($ sql)) { $ title = base64_decode ($ row ['title']); $ price = $ row ['price']; $ seller_user = $ row ['user']; }
$sql = mysql_query("SELECT * FROM item_details WHERE posting_id='$item_number'"); $results = array(); while($row = mysql_fetch_array($sql)) { $results[] = array( 'title' => base64_decode($row['title']), 'price' => $row['price'], 'seller_user' => $row['user'] ); } $json = json_encode($results);