List of links/click a link/making page of data from database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Exodus00
Forum Newbie
Posts: 13
Joined: Mon Aug 05, 2002 11:46 pm
Location: Oregon
Contact:

List of links/click a link/making page of data from database

Post by Exodus00 »

I... have seen this on things liek PHPnuke and such where there is a page of links... drawn from a database.. then when you click on one, it brings up a new page... with all the stuff.. i get how to make the list of links, i understand how to make the new page with all the data, but what i dont get is how to tell that new page what peices of the database to use.... if it was a form it'd be easy.. but this is a link.....can anyone tell me the basic procedure for doing this?? not really code..just procedure... if i knew how to do this, i could tinker a bit and... then work from there... but i cant find it in my book anywhere... cus i'm thinking this is a bit more advanced than a "beginner's" book... anyway.. any help would be greatly appreciated.. if you need anymore questions, i'll try to answer them... currently i have no code typed, but was just hoping for a basic plan of attack on how to do this..
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

:? i dont quite get it

you could have a table like

Code: Select all

==links==
URL==NAME
have a row like

http://foo.com foo

then do

Code: Select all

$qry = mysql_query("SELECT * FROM links");
while($data = mysql_fetch_assoc($qry)){
echo '<a href="'.$data&#1111;'URL'].'">'.$data&#1111;'NAME'].'</a><br/>'."\n";
&#125;
Exodus00
Forum Newbie
Posts: 13
Joined: Mon Aug 05, 2002 11:46 pm
Location: Oregon
Contact:

Post by Exodus00 »

ok.. ummm

you have an SQL table

Number | Name | Description

1 Test 1 Blah
2 Test 2 Blah Again

-----------------------------

ok so then you have this displayed on a site using an SQL query(note these are URL's)

-----------------------------

Test 1
Test 2

-----------------------------
When you click on the URL, it brings you to a page like this(only this isn't an html page, this is just a default page with $variables being filled in, using database info...
-----------------------------

Page name - Test 1

Description - Blah

------------------------------
so what i need to know.. is how to make it.. so that when i click the link, it will query the database, and insert the variables, that correspond to the link selected... also note that the URL's are drawn from a database.. so.. it isn't something manually coded in, but something that can be automatically generated as well.... there is a way to do this.. i just have no idea how... hope that helps a little more.. :?
Post Reply