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 Quote 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'] } } ?> Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.