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!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.