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
Displaying values from a SQL count...
Hi,
Easy enough question i just forget the exact method ..
I have ...
Code: //count win
Wordpress IE issue
So I am trying to add the background shadow to my wordpress page. It works fine in Firefox but does
Remove values in array2 from array1
I have two arrays.
Array 1 is where the array key holds various different numbers. For exampl
problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html &quo
php call servlet
I have done a php backup application .
So there is a form that user pick some files to zip and d
strtotime issue
Hey all,
I'm playing around with some code, and basically the idea is:
Person changes
no idea what to do...
I'm fed up. I had issues with code that I have working on a different site that didn't work on my cu
Form help: Syntax & Logic
Hello again all,
I'm working on a form and ran into a wall (again) and can't seem to think th
Need help/w Page: 1,2,3,4 function!
So I have this code im working on where it's ment to display seperate pages having 20 logs each
I
Problem with PHP code- simple contact form
I'm relativily new to PHP; I know HTML and CSS stuff but I have a problem- I have a contact form wit