Jump to content

Displaying a record from a table as a link in PHP


nclocl

Recommended Posts

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.

Thank you :D

 

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.