473,387 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

link-question

Hi ( and I'm sorry in advance ),
I have looked in php.net but I can't figure out how it's done.
I want to show a list of the three latest inserted posts in a mysql-table.
The list is meant to be an apertizer and the users have to click on it to
see the whole output from the DB.
How do I make the link to open that exact post?

Here is what is working for now:

<?php

$link = mysql_connect("server", "user", "pass")
or die("Could not connect: " . mysql_error());
print ("Connected successfully");
mysql_select_db("database");
$result = mysql_query("SELECT ID, tekst, DATE_FORMAT(dato, '%d %m %Y
kl. %H:%i')as dato FROM henriks ORDER BY ID desc LIMIT 0,3");
while ($raekke = mysql_fetch_array($result)){

echo"<P> ID: ".$raekke['ID']."<br>";
$text = $raekke['tekst'];

echo"Tekst: ".nl2br(substr($text,0,50))."....";
echo"<BR>Dato: ".$raekke['dato'];
}

?>

Regards Ricki
Jul 16 '05 #1
1 1647

Create another php page that expects the ID as a GET variable
as you loop through your dataset (as per your code snippet) do
something like the following:

print "<a href='showpost.php?id={$raekke["ID"]}'>Some Text</a>";

Then showpost.php:


Offcourse; it seems obvious. Thank you!

Ricki
Jul 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matt Adams | last post by:
As well known I could specify the text color in the body tag like: <BODY TEXT=WHITE LINK=WHITE VLINK=RED ALINK=WHITE> What I want to achieve now is that always (!) the text of the last visited...
6
by: Carla | last post by:
hi people, I have a little problem that I can't solve with css and i was wondering if you could help me. I have 4 links, I want that when I click/mouseover in the link 1, it turns to a color...
26
by: Harrie | last post by:
Hi, After Brian mentioned the use for <link rel=..> for navigational purposes in another thread, I've been looking into it and found that HTML 3.2 has two other recognized link types than HTML...
4
by: Franklin | last post by:
WITHOUT KNOWING ANYTHING ABOUT THE CURRENT COLORS, I want to swap the foreground/background colors of a link when someone hovers over it. Is this possible with HTML, CSS, DOM, & JavaScript? If...
8
by: sudhirlko2001 | last post by:
How to swap two nodes of doubly Linklist
1
by: sri2097 | last post by:
Hi all, I have written a Link list implementation in Python (Although it's not needed with Lists and Dictionaries present. I tried it just for the kicks !). Anyway here is the code - # Creating...
7
by: gehegeradeaus | last post by:
Can someone help me to make a regular expression for this sort of replacement : text with {link:pagehref}a link{/link}. replace to -> text with <a href="pagehref">a link</a> I tried...
7
by: Kurda Yon | last post by:
Hi everybody, I cannot understand the following thinks. The last line of the fillowing code produces a message about mistake (not a valid MySQL- Link resource): $link = mysql_connect(...
4
by: perryche | last post by:
Is this possible? Instead of using the link wizard, can the FE/BE link be established any other way that users can simply type the link path? Thanks, Perry
12
by: prashant | last post by:
hi, i am trying to create an xml tag ref to hold link.php?id=1; or link.php?id=2 and so on. I want the links for all the fields(id) in the databse so that when i call them in my html page for...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.