Jump to content

Linking entries from MySQL Database


ee92

Recommended Posts

Hi,

 

I know this topic seems generic but I've searched throughout google and these forums with no result.

 

I have a MySQL database and what I want to do is create a list of the entries (only name field). I need each entry to be hyperlinked and all of them to link to one page. The link will pass the ID field of the entry the person has clicked. From there the second link will take that ID variable and look it up in the MySQL database and pull the rest of the data for that entry to automatically generate an info page.

 

So far I have this code

 

<?php
                           $query="SELECT ID, Name, Location, Price FROM proclist";
                           $status=mysql_query($query) or die( "Query Failed.");
                           ?>


                           <?php while($nt=mysql_fetch_array($status)){
                               echo "$nt[Name]
";
                           }
                           ?>

 

However, as is obvious the "pass=ID" only passes the characters ID. Can anyone help me with a solution for this?

 

Thanks,

 

Zayd

Link to comment
Share on other sites

Thanks Benjamin this was exactly what I was looking for.

 

But when I run this code I get these errors and I can't seem to declare these values:

 

Notice: Use of undefined constant ID - assumed 'ID' in C:\wamp\www\Med\selftest.php on line 185

 

Notice: Use of undefined constant Name - assumed 'Name' in C:\wamp\www\Med\selftest.php on line 185

 

Thank You!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...