dezkit Posted August 19, 2010 Share Posted August 19, 2010 i have this code <?php $rulepages = array(); $rulepages[] = array("name" => "1111213", "page" => "fasdd21.php", "id" => "1"); $rulepages[] = array("name" => "41231245152", "page" => "fasd.php", "id" => "2"); ?> <table width="100%"> <tr> <td width="15%"> <?php sort($rulepages); foreach($rulepages AS $rulepage){ echo "<a href=\"?id=".$rulepage["id"]."\">".$rulepage["name"]."</a>"; echo "<br />"; } ?> </td> <td width="80%"> <?php $id = $_GET["id"]; // ?? ?> </td> </tr> </table> what do i do to search the array where the id equals the get ? thanks Link to comment https://forums.phpfreaks.com/topic/211229-search-the-array-where-the-id-equals-the-get/ Share on other sites More sharing options...
btherl Posted August 19, 2010 Share Posted August 19, 2010 <?php $id = $_GET["id"]; foreach ($rulepages as $rulepage) { if ($rulepage['id'] == $id) { // $rulepage is the one matching $_GET['id'] } } ?> Link to comment https://forums.phpfreaks.com/topic/211229-search-the-array-where-the-id-equals-the-get/#findComment-1101455 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.