nclocl Posted August 20, 2011 Share Posted August 20, 2011 I have the following code: $result = mysql_query("SELECT * FROM ESSAY_QUESTIONS WHERE SUBJECT = 'ENGLISH'") or die(mysql_error()); while($essay_data=mysql_fetch_array($result)){ $question = $essay_data['QUESTION']; $id = $essay_data['ID']; echo "<a href=\"englishessays.php?id=$id>"; echo "$question </a>"; echo "<br><br>"; } It seems to be almost working but it just displays one link and the address is all the rest of the code including </a>"; echo "<br><br>"; and other questions. I presume there's an error with how I've written the echo statements so can anyone see it? Or can anyone suggest a better way to do this? On the next page, the php will read the ID from the address and display the information form that record. Link to comment https://forums.phpfreaks.com/topic/245286-displaying-a-record-from-a-table-as-a-link-in-php/ Share on other sites More sharing options...
MasterACE14 Posted August 20, 2011 Share Posted August 20, 2011 missing the second double quote for the href attribute. this... echo "<a href=\"englishessays.php?id=$id>"; should be this... echo "<a href=\"englishessays.php?id=$id\">"; Link to comment https://forums.phpfreaks.com/topic/245286-displaying-a-record-from-a-table-as-a-link-in-php/#findComment-1259798 Share on other sites More sharing options...
nclocl Posted August 20, 2011 Author Share Posted August 20, 2011 Thank you I will probably have a few more insanely stupid php questions over this weekend. I usually work with oracle and java and decided I could do this for a friend and learn php on the way. I am messing up way more than I anticipated! Link to comment https://forums.phpfreaks.com/topic/245286-displaying-a-record-from-a-table-as-a-link-in-php/#findComment-1259799 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.