PHPro Posted October 21, 2009 Share Posted October 21, 2009 Could anyone please help about making a search result with links. To be specific, I have a list of names in my database. I want to create a search that will list names with links. Its been 5 hours and cant still figure out how it goes. Thank you Quote Link to comment Share on other sites More sharing options...
avvllvva Posted October 21, 2009 Share Posted October 21, 2009 Can you explain it more. Quote Link to comment Share on other sites More sharing options...
trq Posted October 21, 2009 Share Posted October 21, 2009 Links to what? Profile pages? As an example. <?php $sql = "SELECT id, uname FROM users"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { echo "<a href='prefile.php?id={$row['id']}'>{$row['uname']}</a>"; } } } profile.php <?php if (isset($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); $sql = "SELECT email FROM users WHERE id = $id LIMIT 1"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); echo $row['email']; } } } Quote Link to comment Share on other sites More sharing options...
PHPro Posted October 21, 2009 Author Share Posted October 21, 2009 Link to profile Thank you so much Thorpe.Thats exactly what I'm looking for. You refer to this as a pagination right? thanks again sir! Quote Link to comment Share on other sites More sharing options...
trq Posted October 21, 2009 Share Posted October 21, 2009 Link to profile Thank you so much Thorpe.Thats exactly what I'm looking for. You refer to this as a pagination right? thanks again sir! Nope, nothing to do with pagination. Pagination is when you have so many results from one query that you split those results over several pages. Much how this board is split into pages, otherwise this page would need to display something like 150000 records at once. Quote Link to comment Share on other sites More sharing options...
PHPro Posted October 21, 2009 Author Share Posted October 21, 2009 I see . thanks again sir! Quote Link to comment Share on other sites More sharing options...
snallemap Posted September 23, 2010 Share Posted September 23, 2010 Thanks alot 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.