RE: [PHP] Links and Logic

From: Date: Mon, 28 Aug 2000 07:35:51 +0000
Subject: RE: [PHP] Links and Logic
Groups: php.general 
Request: Send a blank email to php-general+get-13904@lists.php.net to get a copy of this message
> but how do you construct a script that recognises the hyperlink > (http://www.xxx.com/data/23) as being item 23, and construct > a page with the info about item 23(from the database) in it? > > Any ideas or links would be appreciated. You need to make a script (lets call it "show.php") that accepts this ID as in input variable, so it would be called by using: http://www.xxx.com/data/show.php?itemid=23 Then in your code: print ("<a href= http://xxx.com/data/show.php?itemid="); print $row["id"]; print (">"); Also, consider: print ("<a href= http://xxx.com/data/" . $row["id"] . ">"); ... for neatness. The "." concatenates (joins) strings. In the resulting script, $itemid will be the value passed in, in this case "23". You then need to "SELECT * FROM <youritemtable> WHERE <youridfield> = $itemid" to get the item's attributes, and output them accordingly. Jason -- Jason Murray jasonm@melbourneit.com.au Web Design Team, Melbourne IT Don't believe everything you're foretold.

« previous php.general (#13904) next »