The.Pr0fess0r Posted September 8, 2009 Share Posted September 8, 2009 Hello, I have a query that outputs 5 columns of data. The first column is the date the trip was taken. I would like to be able to click on that date and have it take me to another page where it shows me all the info about that trip. The problem I am having is that I cannot get the syntax correct. Here is my line of code that I would like linked to another page: echo '<td width="50" align="right">' . substr($row['date_of_hunt'],0,10) . '</td><td width="20"></td>'; The page I want it linked to is trip.php I am using the field id in database. So i'm assuming it would be something like: trip.php?id=$row['id]..but I'm not sure how to put it all together. Any help would be greatly appreciated! Quote Link to comment Share on other sites More sharing options...
micmania1 Posted September 8, 2009 Share Posted September 8, 2009 echo '<td width="50" align="right"><a href="trip.php?id="'.$row['id'].'">' . substr($row['date_of_hunt'],0,10) . '</a></td><td width="20"></td>'; Quote Link to comment Share on other sites More sharing options...
The.Pr0fess0r Posted September 8, 2009 Author Share Posted September 8, 2009 Thank you very much! I had to remove the set of parenthesis just after the = but then it started working. Now I am having problems getting the data to show on the resulting page. What do I have to use to get the data to show up on the trip page? I have the page set up the way I would like with the column headers (i.e. date of trip, hunters, etc) but the data will not show up. I know there is something I have to add to tell it where to pull it from, but i'm not sure what that statement is? If I just put <?php $date_of_hunt >? in a column, nothing shows up. How do I get it to pull the data? For example, on the report page (from the earlier post) let's say I click on the date with the id of 3...so my url looks like: http://www.mysite.com/trip.php?id=3. How do I get it to show the information from id 3? Quote Link to comment Share on other sites More sharing options...
cbolson Posted September 8, 2009 Share Posted September 8, 2009 Hi, You will need to do a new database query on that page using the id that has been sent in the "WHERE" clause. Basically like this: $sql="SELECT your_fields FROM your_table WHERE id=".$_GET["id"]." LIMIT 1"; Chris 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.