Jump to content

Linking multiple MySQL database results to their own page through PHP


Pamberella

Recommended Posts

Hi there, I’m hoping someone can help me, I’ve very new to PHP (as you can probably tell by the poorly worded title) so please bear with me and I hope this makes some sense!

 

I have a webpage that displays articles from a MySQL database, each article is made up of a unique ID, Date, Title, Summary and Text. I have a page which displays all articles from within the database (code shown below)

 

<?php

$db = mysql_connect("localhost", "blabla", "password");

mysql_select_db ("blabla", $db);

$result = mysql_query("SELECT * FROM Articles");//

while($row=mysql_fetch_array($result))

{

echo$row['ID'];//

echo "</br>";

echo$row['Date'];//

echo "</br>";

echo$row['Title'];//

echo "</br>";

echo$row['Summary'];//

echo "</br>";

echo$row['Text'];//

}

?>

 

This page works fine but I want to be able to make an option within the page so that each article can be linked to its own page (displaying the articles ID, date, title, summary and text), so that if a button or the article ID is to be clicked upon that selected article will open in its own separate page. I am having major trouble doing this, I tried to send it through a URL but that was a pretty stupid idea for that amount of data from a database and didn’t work. I was wondering how I can go about making it so every article can be viewed separately in a page of its own.

Thank you so much!

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.