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
Sum of Values in an Array
This is probably really simple... but it's been years since I've written anything, so bare with me!<
Changing color in GD via variable?
Hey guys, I'm new here. x)
I'm very much a noob when it comes to PHP, but I'm trying to learn
Spaghetti Code
So.
I've pretty much reached the point where I have so many isset s on one page that I can't
Need help-Error istream header declaration
Hi Everyone ,
I am having issue with istream declaration. I am new to C programming.
can a
Oracle Connectivity
Hi Every One,
Can we access SAP from oracle database.If it possible then please spec
PHP MySQL and DATE
Hi everyone
I have a databse and in one of the columns I have date values such as 2009-March-
"From field" in PHP email form
I used a wizard to create a PHP email form. I was able to customize it with the exception of the Fr
is_dir() problem
Hello,
I'm buidling a php scripts that dynamically get's subfolders from a specific folder.
Procedure with variable number of columns
Hi, I have a procedure that looks like this:
PROCEDURE PROC(p_cursor OUT sys_refcurso
How would I convert this into code using an if statement?
ES equals exam score m equals $mean s equals $total. I already coded my mean and total so I'm not g