Hi, i made a post earlier on last month. I managed to solve that problem last week.
And now ive got another one.
In my previous post i referred to making the database print out links with the correct URI to the page [see my previous post - here ]
Here is my code:
<?php require_once('Connections/cPete.php'); ?>
<?php
$maxRows_Links = 10;
$pageNum_Links = 0;
if (isset($HTTP_GET_VARS['pageNum_Links'])) {
$pageNum_Links = $HTTP_GET_VARS['pageNum_Links'];
}
$startRow_Links = $pageNum_Links * $maxRows_Links;
mysql_select_db($database_cPete, $cPete);
$query_Links = "SELECT links.link, link_ref.URI FROM links LEFT JOIN link_ref ON links.link_id = link_ref.link_id ORDER BY links.link DESC";
$query_limit_Links = sprintf("%s LIMIT %d, %d", $query_Links, $startRow_Links, $maxRows_Links);
$Links = mysql_query($query_limit_Links, $cPete) or die(mysql_error());
$row_Links = mysql_fetch_assoc($Links);
if (isset($HTTP_GET_VARS['totalRows_Links'])) {
$totalRows_Links = $HTTP_GET_VARS['totalRows_Links'];
} else {
$all_Links = mysql_query($query_Links);
$totalRows_Links = mysql_num_rows($all_Links);
}
$totalPages_Links = ceil($totalRows_Links/$maxRows_Links)-1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="file:///H|/Wednesday-%20Pete%20Website/cssp.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="header"><center class="pagetitle">Pete Hammond Assignments
</center></div>
<div class="content">
<p><br>
<strong>Welcome to Pete Hammonds Assignments</strong></p>
<p>This site aims to keep students at Sheffield College, who are doing Pete's Lectures constant access to resources and assignments.</p>
<p>The site provides access to FDSC Applied Computing, AVCE IT, ACCESS IT, CLAIT, HND Computing.</p>
<p>Please click on the necessary link on your left!</p>
</div>
<div class="nav">
<?php do { ?>
<?php $link = $row_Links['URI']; ?>
<?php if ($link = "") { ?>
<p><?php echo ucfirst($row_Links['link']); ?></p><br>
<?php } else { ?>
<p><a href="<?php echo htmlentities($row_Links['/URI']); ?>"> <?php echo $row_Links['link'] ?></a></p>
<?php } ?>
<?php } while ($row_Links = mysql_fetch_assoc($Links)); ?>
<hr>
<p><a href="#">Admin Page </a>
<p><a href="#">Contact Me </a></p>
</div>
</body>
</html>
<?php
mysql_free_result($Links);
?>
The navigation is formatted using a style sheet.
What i would like it to do is to display a link with a URI in a hyperlink: Like this.
<p> <a href="[URI]"> Link Name </a> <p>
and if the link doesnt have a URI like this
<p> Link Name </p>
The problem is when it runs, it encases the Link whether or not it URI or not.
Thanks again!
Tom