Links not updating
Posted on
16th Feb 2014 07:03 pm by
admin
I'm trying to fuel a simple navigation system for a news section. It works fine when it comes to retrieving and displaying data, but if I click on a valid link in the following code, the content and links do not update like they should. All hrefs stay the same and the content does not change. Why is this?
Code: [Select]require('../scripts/chron.php');
$con = openConnect();
// Get current entry ID, using -1 to mark an unavailable param.
$entry = (isset($_GET['id'])) ? $_GET['id'] : -1;
// Query table for vital entry info
$type = 'news';
$count = getEntryCount($type);
// Go to latest entry if param is unavailable.
if ( $entry = -1 ) $entry = $count;
// Build links for navigation
$first = $entry<=1 ? 'undef' : 0;
$prev = $entry<=1 ? 'undef' : $entry-1;
$next = $entry < $count ? $entry+1 : 'undef';
$last = $entry < $count ? $count : 'undef';
echo '<div class="newsLinks"><p>';
echo ($first != 'undef') ? ('<a href="index.php?id='.$first.'">First</a> - ') : ('First - ');
echo ($prev != 'undef') ? ('<a href="index.php?id='.$prev.'">Previous</a> - ') : ('Previous - ');
echo ($next != 'undef') ? ('<a href="index.php?id='.$next.'">Next</a> - ') : ('Next - ');
echo ($last != 'undef') ? ('<a href="index.php?id='.$last.'">Last</a>') : ('Last');
echo '</p></div>';
$row = getEntryRow($type,$entry);
// Display entry
echo '<h1 class="centerHead" id="Title">' . $row['title'] . '</h1>';
echo '<h3 class="centerHead" id="DatePosted">' . $row['datePosted']. '</h3>';
echo '<div class="newsBody" id="CurrentContent">' . $row['content'] . '</div>';
No comments posted yet
Your Answer:
Login to answer
58
18
Other forums
Problem in OnClientClick and OnClick sync
Hi,Strange and irritating problem:
I have below button declaration in markup of the aspx page:
Not adding to db
Hi, I can't figure out why it won't add the record to the database. It's just a simple form to get
BIG file upload!
Hey guys!
I'm trying to upload a file, it works well with smaller files but with 60mb+, I get
want a code for uploading and downloading
i m trying to upload and download to my site..i need upload and download code ...i use a code for up
Help with captcha script needed
Hello,
I am working on a script where reCAPTCHA or a similar form of CAPTCHA will be used, f
Need help adding a timestamp to my filename/variable
Hello,
I'm kind of stupid when it comes to php and I need a tiny bit of help. I've got a f
form help
this doesn't work. i want the form action to go the location.href of the submit button chosen.. how
problems with script
I made a small script wich exchanges points in my website:
<?php
session_start
string to currency format
Hi guys...
Actually I chunk out some data from txtfile and one of the data contains amount va
Read from forum
Haven't written anything forever and I would like to get back.
What I'm trying to do is getting t