I have a database that has a table of assignments
CREATE TABLE `assignments` (
`a_id` int NOT NULL AUTO_INCREMENT,
`title` varchar(50) NOT NULL,
`description` varchar(250) NOT NULL,
`file` varchar(50) NOT NULL,
` deadline ` datetime NOT NULL,
PRIMARY KEY (`a_id`)
)
in my website I would like to view assignments by title, then click on each title (title should be hyperlinked ) to be redirected to details of this specific assignment. here's what I've got so far
// Get records from the database
$query = $db->query("SELECT * FROM assignments ORDER BY a_id ASC ");
if($query->num_rows > 0){
while($row = $query->fetch_assoc()){
$assigment_title = $row['a_id'];
?>
<div class="list_item">
<?php echo "<tr><td><a href= 'A i'>" . $row["title"]. "</a></td></tr>"; ?></div>
the problem is 'A i' part, what I want is for the href to change according to the title, I am new to php and I cannot find my workaround. assuming I have a list of urls: A 1,A 2,...A n TIA
source https://stackoverflow.com/questions/70173671/create-url-using-data-fetched-from-database-in-my-webpage
Comments
Post a Comment