php - filter json results based on value with url -


i running mysql query in php file , parsing json follow:

$json_response = array();  while ($row = mysql_fetch_array($result, mysql_assoc)) {     $row_array['artist'] = $row['artist'];     $row_array['song'] = $row['song'];      //push values in array     array_push($json_response,$row_array); }  echo json_encode($json_response); 

there thousands of entries; there way can filter json results based on value? like: mylink.php/artist1 or mylink.php?artist=1

i appreciate sort of ideas.

thanks

you can so:

// artist info $artist_id = isset($_get['artist']) ? intval($_get['artist']) : 0; $sql = "select * artist"; if($artist_id)     $sql .= " artist=$artist_id"; mysql_query($sql); 

Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -