473,387 Members | 1,705 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.

Dynamic Link/Content with PHP

Hi,
I've created a mySQL database with the fields id, title and content.
'ID' is a unique field. Any ideas on how I can use PHP to generate a
list of the titles which are links. When you click on a link you are
taken to a page with the content held in the database. I'm guessing the
generated links would be something like /page.PHP?pageid=x based on the
id, that's if this script is possible at all.

Sorry for being such a newbie, but I guess we all have to start somewhere.

Thanks,
Ben
Jul 27 '05 #1
3 3020
Ben Allen wrote:
Hi,
I've created a mySQL database with the fields id, title and content.
'ID' is a unique field. Any ideas on how I can use PHP to generate a
list of the titles which are links. When you click on a link you are
taken to a page with the content held in the database. I'm guessing the
generated links would be something like /page.PHP?pageid=x based on the
id, that's if this script is possible at all.

Sorry for being such a newbie, but I guess we all have to start somewhere.

Thanks,
Ben

Ben,

This is exactly what php does, and you seem to be off to a good start.
Have you tried writing any code yet or do you have any more specific
questions?

If you are just starting out, I would suggest first writing a webpage
which simply lists all the items in the database. If there are many
items, you might consider splitting them up into usable chunks of 10-20
per page.
http://www.php.net/manual/en/index.php
http://www.php.net/manual/en/ref.mysql.php

Once that is working, turn the list into a list of links, your proposed
url format looks fine, though I wouldn't name a page 'page.php', how
about 'display.php'.
http://idocs.com/tags/linking/_A.html
http://www.php.net/variables.external
Once you have completed those first two steps you should write the
display.php page, which retrieves the item details from the database
using the id you passed in the url (this can be retrieved from the $_GET
array in php.
http://www.php.net/variables.external
http://www.php.net/manual/en/reserve....variables.get
Jul 27 '05 #2
Carl wrote:
Ben Allen wrote:
Hi,
I've created a mySQL database with the fields id, title and content.
'ID' is a unique field. Any ideas on how I can use PHP to generate a
list of the titles which are links. When you click on a link you are
taken to a page with the content held in the database. I'm guessing
the generated links would be something like /page.PHP?pageid=x based
on the id, that's if this script is possible at all.

Sorry for being such a newbie, but I guess we all have to start
somewhere.

Thanks,
Ben


Ben,

This is exactly what php does, and you seem to be off to a good start.
Have you tried writing any code yet or do you have any more specific
questions?

If you are just starting out, I would suggest first writing a webpage
which simply lists all the items in the database. If there are many
items, you might consider splitting them up into usable chunks of 10-20
per page.
http://www.php.net/manual/en/index.php
http://www.php.net/manual/en/ref.mysql.php

Once that is working, turn the list into a list of links, your proposed
url format looks fine, though I wouldn't name a page 'page.php', how
about 'display.php'.
http://idocs.com/tags/linking/_A.html
http://www.php.net/variables.external
Once you have completed those first two steps you should write the
display.php page, which retrieves the item details from the database
using the id you passed in the url (this can be retrieved from the $_GET
array in php.
http://www.php.net/variables.external
http://www.php.net/manual/en/reserve....variables.get


Thanks for the quick reply Carl,
I've used php before, a basic form to add stuff to a database and also a
script to list from a database. It was the turning them automatically
into links and then clicking on that link to bring up a page filled from
a database that confused me. I haven't written any code for this
particular piece yet. I'm still not sure how to use the $_GET to
retrieve the information but I guess I'll figure it out, I've use $_get
before to pass an email address from one page to another (not very
securely I know, but it was more of a test script). Anyway, I'll give it
ago, thanks for the information.

Cheers,
Ben
Jul 27 '05 #3
Ben Allen wrote:
Hi,
I've created a mySQL database with the fields id, title and content.
'ID' is a unique field. Any ideas on how I can use PHP to generate a
list of the titles which are links. When you click on a link you are
taken to a page with the content held in the database. I'm guessing the
generated links would be something like /page.PHP?pageid=x based on the
id, that's if this script is possible at all.

Sorry for being such a newbie, but I guess we all have to start somewhere.

Thanks,
Ben

It seems I found what I need here:
http://www.php-mysql-tutorial.com/cms-php-mysql.php

If, after further reading, this isn't what I need I'll resort to using
my own code.

Thanks,
Ben
Jul 27 '05 #4

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

Similar topics

4
by: Daniel Keller | last post by:
Hello! I'm trying to set up a page system using "dynamic" SSI. That means that I normally use the following on my website: <!--#include virtual="file.inc" --> Now I want to make this...
3
by: John Ortt | last post by:
I appologise for reposting this but I have been trying to find a solution all week with no avail and I was hoping a repost might help somebody more knowledgable than myself to spot the message... ...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
4
by: namemattersnot | last post by:
Re, SCENARIO: User clicks a link and a javascript function creates dynamic content in <div id="content"></div> using: document.getElementById("content").innerHTML = something In the page's...
2
by: JWL | last post by:
Hi I need to create a bunch of sites with slightly dynamic CSS. Basically, all the image paths in the CSS need to be dynamic, depending on the values of certain ASP variables. I can think of...
1
by: nsvmani | last post by:
Hi, i am trying to get the FileOpen dialogue window as soon as clicked href link I am using IE6 with ActiveX enabled. Just need to get the File Open dialogue window when i click on the HREF links.It...
1
by: aolba | last post by:
I manage to use an example of AJAX to insert dynamic content inside DIVs. Everything goes OK, until I noted the dynamic content didn't dysplay the flash animation. I didn' get errors or anything....
21
by: karen987 | last post by:
I have a news website, with asp pages. It has publishing software which allows you to add articles in a database, and then calls them up from links etc. I have added dynamic meta tags in 2 parts. The...
9
by: lilOlMe | last post by:
Hi there! I have generated a GridView that looks something like: SportName| CompanyNameX |CompanyNameY |CompanyNameZ Hockey.....| Shipping------------ |Accounting-------- |Shipping------------...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.