Re: Dynamic Link/Content with PHP



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/reserved.variables.php#reserved.variables.get
.




Relevant Pages

  • Re: Getting a list of list permissions for WSS
    ... this on a backup copy of the database so you're not hitting the live DB. ... Now when you run the script and refresh the SPS Event List which this ... my departmental Event Lists roll-up flawlessly to a single Portal list. ...
    (microsoft.public.sharepoint.portalserver)
  • Re: Dependant listboxes
    ... I have a page with 3 combo box that contains rows from an oracle database. ... is to make those list dependant one from another. ... to implement the dependant lists? ... This popular PHP forms generation and validation class has a linked ...
    (php.general)
  • Re: The Sorrows of Record Cataloguing
    ... but the database ... needed was a list so that I wouldn't buy records or CDs over again. ... to see on the shelves and were in alpha-order by composer. ... recordings, there is an entirely different set of lists -- five lists, ...
    (rec.music.classical.recordings)
  • Re: Are you one of the EIGHT MILLION who will be arrested when Bush declares martial law in October?
    ... Called "Main Core," the database's origins date back to the 1980s when ... "There exists a database ... of Americans, who, often for the slightest and most trivial reason, ... called someone on those lists, you get added to the master list. ...
    (alt.politics)
  • www.CeBeans.com - new program listings - Dec 17 2007
    ... This program is a database of 24 Christmas/Holdiay tips for a safe season. ... This program is a database of 24 cooking email lists that you can subscribe ... The object of this game is to use your taser gun to shoot down the birds ... Free man every round after five. ...
    (microsoft.public.pocketpc)