stirrah Posted September 19, 2013 Share Posted September 19, 2013 (edited) Hello! I have made a query and displaying this - it's working. But I want this query-result to be a link (href) to another query that I want to display. My query right now is: <ul> <?php $test = mysql_query("SELECT * FROM `huvudProject` WHERE `categoryProject` = 1"); while($row = mysql_fetch_assoc($test)) { echo "<li>" . $row['huvudProjectName'] . "</li>"; } ?> </ul> I want the 'huvudProjectName' be the name of a link. How can I do this? Also, I want this link to do a query when I click it for this: SELECT * FROM `project` WHERE `projectHuvudId` = 1 And then show the result somewhere. Is this possible? Edited September 19, 2013 by stirrah Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted September 19, 2013 Share Posted September 19, 2013 have you researched what the html syntax is of a href link and attempted to solve this yourself? its a pretty basic task and someone posting the solution would allow you to see what it looks like, but that doesn't teach you how to define what you want and do the coding to accomplish it. Quote Link to comment Share on other sites More sharing options...
stirrah Posted September 19, 2013 Author Share Posted September 19, 2013 Thats true....and I've come up with this: echo "<li><a href='Http://www.testlink.com'>" . $row['huvudProjectName'] . "</a></li>"; But how can I make a query instead of the testlink and then show it on another page? Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted September 19, 2013 Share Posted September 19, 2013 (edited) Well make it a link to another page like project.php and pass it the 1 parameter but I'm not sure where you get the 1 one the original page. Is there a projectHuvudId column in the huvudProject table or does the 1 come from the categoryProject column? echo "<li><a href='http://www.testlink.com/project.php?id=" . $row['projectHuvudId'] . "'>" . $row['huvudProjectName'] . "</a></li>"; //project.php if(isset($_GET['id'])) { $id = (int)$_GET['id']; //SELECT * FROM `project` WHERE `projectHuvudId` = $id } Edited September 19, 2013 by AbraCadaver 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.