Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,628 members, 7,816,588 topics. Date: Friday, 03 May 2024 at 01:33 PM

How To Create A Link On Post Title In My Blog Home Page. I - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How To Create A Link On Post Title In My Blog Home Page. I (877 Views)

HTML Program For Home Page Of A Website Designing Company / What Does Nairaland show On Its Home Page? Latest Posts Or Popular? / Free 10 Days Boot Camp On Web Design (project: Facebook Home Page Design) (2) (3) (4)

(1) (Reply) (Go Down)

How To Create A Link On Post Title In My Blog Home Page. I by Emekuss(m): 10:20pm On Dec 07, 2018
Please everyone, I need a code in PHP that will help me to create a link on post titles after getting the data from database.

This link will now lead to the contents of the post.

Same thing as the homepage of this Nairaland forum.
Re: How To Create A Link On Post Title In My Blog Home Page. I by silento(m): 12:24am On Dec 08, 2018
am so surprised nobody has answered this question since it was posted
Re: How To Create A Link On Post Title In My Blog Home Page. I by silento(m): 12:39am On Dec 08, 2018
demo (not real code but it will help you out):

lets say for example your mysql table for post look like below:

Table : blog_post

-----id---|----title-----|-----content------------------------------------------|-date-------|------author------|

34 | davido hate rice | now is clear that davido hate rice because of stew | 2018-07-23 | aboy_dj


now your php code should be something like this - follow the steps well

1. make connection to database (mysqli or pdo) me i use only pdo beacuse of the ease and advantage
2. prepare and query your dbase for the info use name
example :

sql = "select * from blog_post";


after you fetch and get data you need


loop through you fetched data

and do some thing like this

while(data):

echo "<div><h1>".data["title"]."</h1></div>";



that's it

1 Like

Re: How To Create A Link On Post Title In My Blog Home Page. I by etoluw: 5:43pm On Dec 10, 2018
in order to achieve that you'll need to use url rewrite

example
d link will be something like www.mysite.com/davido-hate-rice

since this url does not exist you have to redirect all request to a particular page where the contents of d url are used to make database lookup

u can achieve this by crrating .htaccess file
and write

FallbackResource /fallbackpage.php

(1) (Reply)

Where Do I Get Consulting Services About Software Developing? / I Need Someone To Teach Me How To Hack / [GAME DEVELOPMENT] Switching Between Multiple Screens In A Processing Game

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 8
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.