- English -
Resident Freddy
- Joined
- Apr 7, 2004
- Messages
- 5,263
The following is a piece of code from my website which I am in the process of doing. I am reading from a database and I want to link to reference the subject ID for example when i click on the home page it will display "http://website/content.php?subj=1".
I have lost myself in trying loads of different ways and Ive come to the conclusion that you cannot do this under a href tag, as it doesnt allow php tags above it.
Any pointers in the right direction please?
I have lost myself in trying loads of different ways and Ive come to the conclusion that you cannot do this under a href tag, as it doesnt allow php tags above it.
Code:
<li><a href="content.php?subj=['id']> //or something similar
<?php
$result = mysql_query(" //query gets read into result variable
SELECT * FROM subjects //subjects is DB table
WHERE id = 1 //ID is primary key
", $connection); //ignore the connection thingy
confirm_query($result); //validation to check if query is valid
while ($row = mysql_fetch_array($result)) { //loop for the print array command
echo $row ["menu_name"];
}
?>
</a></li>
Any pointers in the right direction please?