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
MySQL noob question
hi guys
I have a simple mysql table set up, along the lines of
Col 1 - Col 2 - Date_l
How to generate a text file using php...?
Hi,
Can anyone give me code to generate a text file using php
Thanks in advance
Feed Maker
Hi all.
First of all I must say I am not a php developer so I am afraid I don't know much about i
need help in update query
hi
i have a dynamic form. i need help in how can i use update query when values from dynamic for
search function
HI guys,
if anyone could point us in the right direction of how to do this, or provide some t
Multiple submit forms inside a mysql array page
Hi all,
Im having trouble to get the beneath script to work the thing i can't seem to get wor
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
paginate search result
Hi, I have a paginations script to display data from my database but i would like to paginate someon
php call servlet
I have done a php backup application .
So there is a form that user pick some files to zip and d
Something like an INI editor or a DelimitedText-Editor
Hi all,
Am very, very, very new to PHP and not sure if I should be posting this to a Javascri