aztec Posted November 25, 2006 Share Posted November 25, 2006 Hello to the mastersMy dev setup is Apache,MySql and PHP. I can get names from my database and display on my php page in a table, (that is what you say tables are for). I then need to make each name displayed into a link to a page about that person. For example one of the 20 names returned and displyed is John Doe. I would like to be able to click on John Doe and it dislays all the info about him plus 19 more links. I am sure it can be done but at this moment it is beyond my knowledge of PHP. My thanks in advance for any help givenThanks to taith for getting me stated Link to comment https://forums.phpfreaks.com/topic/28431-changing-names-returned-into-links/ Share on other sites More sharing options...
ataria Posted November 25, 2006 Share Posted November 25, 2006 Easy.Do a profile page, then use a fetch array query to get all his information.display it in a table (or whatever you want)Suggestion; Making ID's for them (for every row). then in the URL do 'page.php?id=1' then, you can just use that number to do the fetch 'SELECT * FROM `table` WHERE `id`='$_GET[id']''I hope that wasn't too confusing.. =/then on another page do a list of everyone . :] Link to comment https://forums.phpfreaks.com/topic/28431-changing-names-returned-into-links/#findComment-130101 Share on other sites More sharing options...
aztec Posted November 25, 2006 Author Share Posted November 25, 2006 Thanks for your inputI can get my head around most of it. All of the records have a ID and all the names info is linked in the database. What I cannot see is when I display the info ie "John Doe" would that become clickable automatically, if it does I am afaid I cannot see how, but I am still learning.Regards Link to comment https://forums.phpfreaks.com/topic/28431-changing-names-returned-into-links/#findComment-130104 Share on other sites More sharing options...
ataria Posted November 26, 2006 Share Posted November 26, 2006 No.You'll have to do it yourself. You'll have two pages..1. the list.2. the profiles. Link to comment https://forums.phpfreaks.com/topic/28431-changing-names-returned-into-links/#findComment-130293 Share on other sites More sharing options...
JasonLewis Posted November 26, 2006 Share Posted November 26, 2006 following on what ataria said, your table would look something like this:ID (int, auto_increment) | name | info--------------------------------------1 John some info about john hereetc. etc.by making ID an auto_increment field it means that it will automaticly increase, funny about that ay?anyways.then you can make a list by just doing a while loop and fetching all the users but only displaying there username. link there username so its something like: viewuser.php?userid=1on viewuser.php you use $_GET to retrieve the userid from the link.[code=php:0]$id = $_GET['userid'];[/code]then you would just select all the information for that id from the table.your query would look something like this:[code=php:0]$result = mysql_query("SELECT * FROM `table` WHERE `id`='{$id}'");[/code] Link to comment https://forums.phpfreaks.com/topic/28431-changing-names-returned-into-links/#findComment-130301 Share on other sites More sharing options...
aztec Posted November 26, 2006 Author Share Posted November 26, 2006 Thanks to you all, your input certainly helps. I'll get to work on this and see what I can do then I may need to get back to you again.Regards Link to comment https://forums.phpfreaks.com/topic/28431-changing-names-returned-into-links/#findComment-130443 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.