jxdvzjnywf
New Member
I have this PHP code, which retrieves and saves a field from a database\[code\]$dblink = mysql_connect('localhost', 'root', '') or die( mysql_error() );mysql_select_db('payment');$query = mysql_query("SELECT level FROM levelPrice WHERE code = 101");$rows = array();while($r = mysql_fetch_assoc($query)) { $rows[] = $r;}echo json_encode(array("#" => $rows));?>\[/code\]And in my HTML I have this:\[code\] <script> $.getJSON('getLevel.php', function(data) { $("#level").val(JSON.stringify(data)); }); </script> \[/code\]The thing is, it does return the value, but it appears with a lot of trash. It looks like this in the website: \[code\]{"#":[{"level":"4"}]}\[/code\] when I only need the number (e.g. #4) to appear in the website, without all the brackets and stuff. Thanks!