SuperTini Posted November 15, 2008 Share Posted November 15, 2008 Hi, I am working on a website with php and mysql. On the front page of the website I only show a summaray (or the first 5 lines) of each article that is posted. Under these five lines I want to have a link that says something line "...click here to read the whole article". All the articles that are posted are stored in a database. My question is now how do I use php to link to a "whole article"? My table looks something like thist: id | title | message | author ________________________________________ 1 | something | text blablablabla | paul ________________________________________ 2 | hello | what a text | christine ________________________________________ thanks for helping:) Link to comment https://forums.phpfreaks.com/topic/132825-php-and-links-help/ Share on other sites More sharing options...
.josh Posted November 15, 2008 Share Posted November 15, 2008 put the article id in the link and then select the article from the db from the passed id. Link to comment https://forums.phpfreaks.com/topic/132825-php-and-links-help/#findComment-690770 Share on other sites More sharing options...
SuperTini Posted November 15, 2008 Author Share Posted November 15, 2008 Like this: <a href="showarticle.php?innleggID=' .$result->ID. ' ">read more</a> ? Link to comment https://forums.phpfreaks.com/topic/132825-php-and-links-help/#findComment-690776 Share on other sites More sharing options...
.josh Posted November 15, 2008 Share Posted November 15, 2008 if that's where you have your query result article id stored, then yes. And then on the next page, you can access that id from $_GET['innleggID'] and run a query based off that. edit: well I think you have your quotes wrong.. <a href="showarticle.php?innleggID=' .$result->ID. ' ">read more</a> should be something like echo "<a href='showarticle.php?innleggID=" .$result->ID. "'>read more</a>"; Link to comment https://forums.phpfreaks.com/topic/132825-php-and-links-help/#findComment-690780 Share on other sites More sharing options...
SuperTini Posted November 15, 2008 Author Share Posted November 15, 2008 hi, thanks, but that is actually my problem, I don't know how to get the id and to show it on the site. Could you give me a code example? Greets. Link to comment https://forums.phpfreaks.com/topic/132825-php-and-links-help/#findComment-690910 Share on other sites More sharing options...
SuperTini Posted November 15, 2008 Author Share Posted November 15, 2008 or maybe, could you give me a link, because I couldn't find it on php.net Link to comment https://forums.phpfreaks.com/topic/132825-php-and-links-help/#findComment-690915 Share on other sites More sharing options...
.josh Posted November 15, 2008 Share Posted November 15, 2008 You get the id the same way you got the rest of your information...by selecting it. Do you not have anything else selected from your db? Your OP suggest that you do... Link to comment https://forums.phpfreaks.com/topic/132825-php-and-links-help/#findComment-690964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.