₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,329,973 members, 8,443,243 topics. Date: Saturday, 11 July 2026 at 12:39 PM

Toggle theme

Help With This Php Problem - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingHelp With This Php Problem (1140 Views)

1 Reply (Go Down)

Help With This Php Problem by Aybee92(op): 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
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(op): 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

This Php Server Remote Addr Is Giving Me Different Device Ip AddressIdentify The Name Of This Php Script234

How To Create Transparent Login Form Design With Html And CssData Science Is Overly Hyped By Nairalanders