MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 11th, 2004, 10:11 AM
tox tox is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 9 tox User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
help with PHP, MySQL

while ($rad=mysql_fetch_array($result))
{
$echo_arhnr[$m]=$rad["arhnr"];
echo "<A HREF='lugem.php'>$echo_arhnr[$m]</A> , ";}
---
I made variables from MySQL database as links. It should look like this:

Link1 , Link2 , Link3 ,

If user clicks on one of these links, he is directed to a new page called 'lugem.php'
How can I define, which link he clicked? Because, I want that page ('lugem.php') to display the information requested from MySQL db under the clicked link variable.

To make it clear:
user clicks Link2. He is directed to 'lugem.php'. Now PHP should request data from MySQL for this Link2.

eh, English is hard :/

thx.

Reply With Quote
  #2  
Old February 12th, 2004, 01:48 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
the way I would do this is using HTTP-GET (also known as URL Rewriting)

Here's an example which reads the label for the link and an id or information for the other page...
PHP Code:
 $result mysql_query("SELECT id, text FROM table_of_links");

while (
$data mysql_fetch_assoc($result)) {
     echo 
"<A HREF='page.php?id=$id'>$text</A> , ";


Reply With Quote
  #3  
Old February 12th, 2004, 07:56 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
If you can do better, Spongy, step up. No point in harrassing the moderators, who volunteer time to help people all over the forums and so sometimes miss a line of code in their haste to move to the next floundering programmer's problem.
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
  #4  
Old February 12th, 2004, 05:26 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Alright, looking at my post I did miss something...
echo "<A HREF='page.php?id=".$data['id']."'>".$data['id']."</A> , ";

I don't understand what else you want?

page.php would need a way to handle the query string... typically $_GET['id'] (from my example)...
for example: $result=mysql_query("SELECT * FROM table WHERE id=".$_GET['id']);

If you know how this works, did i misinterpet your question?

Reply With Quote
  #5  
Old February 13th, 2004, 03:13 AM
Spongy's Avatar
Spongy Spongy is offline
Alternately High
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Hilversum, Netherlands
Posts: 223 Spongy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 56 m 41 sec
Reputation Power: 5
Send a message via MSN to Spongy
This is indeed the best way to handle such a problem.
I'm sorry, MadCozDzz...
BTW: this was not my question....

Reply With Quote
  #6  
Old February 13th, 2004, 10:56 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
tox,
does this answer your question?

Spongy,
no hurt feelings

Reply With Quote
  #7  
Old February 16th, 2004, 03:04 AM
tox tox is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 9 tox User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes it does, and thank You. And also I'm sorry I didn't get to respond to this post earlier, I was at home all weekend, and have no access to internet over there.

I'm sorry and thanks.

Tox

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > help with PHP, MySQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT