ee92 Posted February 8, 2009 Report Share Posted February 8, 2009 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 Quote Link to comment Share on other sites More sharing options...
falkencreative Posted February 8, 2009 Report Share Posted February 8, 2009 If I am understanding you correctly, it sounds like you would need to include the element within the loop, something along these lines: $query="SELECT ID, Name, Location, Price FROM proclist"; $status=mysql_query($query) or die( "Query Failed."); ?> echo '' . $nt[Name] . ' '; } ?> Quote Link to comment Share on other sites More sharing options...
ee92 Posted February 9, 2009 Author Report Share Posted February 9, 2009 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! Quote Link to comment Share on other sites More sharing options...
sjhwebdesign Posted February 9, 2009 Report Share Posted February 9, 2009 <?php $query="SELECT ID, Name, Location, Price FROM proclist"; $status=mysql_query($query) or die( "Query Failed."); ?> <?php while($nt=mysql_fetch_array($status)){ ?> <?php echo $nt['Name']; ?> <?php } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.