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 Like 18 Dislike
Previous forums Next forums
Other forums

array_map() probably obvious mistake
The code below is part of a class to escape strings, but should also accept an array, using array_ma

Not Loading Function Into Div
I'm not sure whether to put this under the php forum or ajax forum but because I tink it's more of a

array_diff weirdness
I'm using the following bit of code

$diff = array_diff($pids, $pidlist);
$diff = array_va

Gantt Chart Tool
Does anyone know of a good free gantt chart creator tool

Thanks

Find only certain URLs from page ... regex (semi-complete script)
Hi guys,

What I need to do is take a page & extract all the URLs from the page &a

Do While statement
hi guys,

This may sound trivial but im new to php and as part of an assignmenti have to const

adding 0 to numbers
Hey guys i need to create a 00001 number in a loop. Is there a better way of forcing a 5 digit numbe

Problem with php's rename function
So, i'm having a problem with the php rename function. Basically my script 'delete_user.php' attempt

Undefined offset when using a flat file with pipe symbols
Hi, I've got a flat file/text file which I'm currently using as a member database for my site (not a

Force download script not handling files with spaces properly
I have a regular old php force download script, uses this code:

Code: header("Cache-Cont

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash