braden Posted March 13, 2008 Share Posted March 13, 2008 I wanted to know how to post the mysql record "id" in the url (ie http://mysite.com/searchresult.php?id=326) after a search. Is there a particular function that would let me echo that variable in the url after a search? This way I can use "get" for navigation. Regards, Bradem Quote Link to comment Share on other sites More sharing options...
atticus Posted March 13, 2008 Share Posted March 13, 2008 Bradem, please give more details about the search. Do you want the pages found in the search to have the link id, or the actual search results page. Quote Link to comment Share on other sites More sharing options...
soycharliente Posted March 13, 2008 Share Posted March 13, 2008 <?php $id = $_GET['id']; $sql = "SELECT * FROM `table` WHERE `id`='$id'"; $result = mysql_query($sql) OR DIE("$sql :: ".mysql_error()); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { // do something } } else { // do something else } ?> Quote Link to comment Share on other sites More sharing options...
soycharliente Posted March 13, 2008 Share Posted March 13, 2008 Also you want to remember that with using $_GET comes some security issues. So Google for $_GET and security to see what some of the best practices are when using it. Quote Link to comment 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.