Welcome, Guest: Join Nairaland / LOGIN! / Trending / Recent / New
Stats: 2,775,640 members, 6,612,155 topics. Date: Wednesday, 01 December 2021 at 07:17 PM

Help With This Php Problem - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Help With This Php Problem (893 Views)

This Php Server Remote Addr Is Giving Me Different Device Ip Address / Please Help Me In This PHP Pagination Code / If You Can Modify This Php Source Code Drop Your Contact (2) (3) (4)

(1) (Reply) (Go Down)

Help With This Php Problem by Aybee92(m): 3:47pm On Oct 23, 2018
Good day guys, am a newbie and I need your help. Am currently learning php and Mysql.

I have a database table titles 'threads' with four columns (Id, subject, body, postdate).

This is what I wanted to accomplish, I want to display all the subject column as a link so that when someone click on it, it will take you to a page where it will display the "post subject and the body". similar to nairand.

Please guys how do I go about this?
Am trying to create a simple forum just for learning sake. Thanks
Re: Help With This Php Problem by Doughboysss: 4:05pm On Oct 23, 2018
can u post ur code
Re: Help With This Php Problem by webapi: 7:01pm On Oct 23, 2018
Aybee92:
Good day guys, am a newbie and I need your help. Am currently learning php and Mysql.

I have a database table titles 'threads' with four columns (Id, subject, body, postdate).

This is what I wanted to accomplish, I want to display all the subject column as a link so that when someone click on it, it will take you to a page where it will display the "post subject and the body". similar to nairand.

Please guys how do I go about this?
Am trying to create a simple forum just for learning sake. Thanks
Loop through them

1 Like

Re: Help With This Php Problem by Ayemileto(m): 7:55pm On Oct 23, 2018
Fetch subject from database using the normal way you use to fetch database result.

Loop through the result the Normal way you loop through your db result but in this case, you put your link in the HTML link tag.

To read contents, you can create a new page, say details.php and pass subject as a get variable.


For example::

Your links will look like

Website-url/details.php?first-subject

Website-url/details.php? Second-subject

In your php loop, it might just be:

Echo "<a href="details.php?$row[" Subject"]>$row[" subject" ]</a>


In your details.php file, use get to get the subject, and using where clause in your query, get the db row with that subject.
Re: Help With This Php Problem by Aybee92(m): 11:08am On Oct 25, 2018
Ayemileto:
Fetch subject from database using the normal way you use to fetch database result.

Loop through the result the Normal way you loop through your db result but in this case, you put your link in the HTML link tag.

To read contents, you can create a new page, say details.php and pass subject as a get variable.


For example::

Your links will look like

Website-url/details.php?first-subject

Website-url/details.php? Second-subject

In your php loop, it might just be:

Echo "<a href="details.php?$row[" Subject"]>$row[" subject" ]</a>


In your details.php file, use get to get the subject, and using where clause in your query, get the db row with that subject.
waw thanks so much. this is really helpful.
Re: Help With This Php Problem by Ayemileto(m): 3:03pm On Oct 25, 2018
Aybee92:
waw thanks so much. this is really helpful.

You are welcome bro.

(1) (Reply)

HELP: Paystack Payment Integration / Join the Latest Social network / Are You A Developer With Low Salary?? This Is What You Can Do

(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 - 2021 Oluwaseun Osewa. All rights reserved. See How To Advertise. 52
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.