I have a problem. I have a one page website and if there is posted a message a posts shows up and below the post there needs to be an image, but on the last on the index page I don't want an image to show up. So it's like if the id from the database is the highest that post doesn't get a image below it.
Here is the code:
<?php
include 'functions/image/functions.php';
$countQuery = $db->prepare("SELECT paginaNummer AS max FROM pages ;");
$countRow = $countQuery->fetch();
$maxId = $countRow['max'];
$query = $db->prepare("SELECT * FROM pages");
$query->execute();
$num_cols = 1;
$i = 0;
$imgList = getImagesFromDir($root . $path);
$img = getRandomFromArray($imgList);
while($row = $query->fetch()) {
if(isset($row)) {
echo "<section data-stellar-background-ratio='0.5'>";
echo "<div class='panelContainer'>";
echo "<div class='panel2'>";
echo "<div class='symbol3'></div>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</section>";
echo "<section class='wrapper'>";
echo "<div class='box'>";
echo "<div class='content'>";
echo $i++ % $num_cols == 0 ? '' : '';
echo "<div id='message'><h2> ", $row['berichtNaam'], "</h2>";
echo $row['paginaContent'], "<br />";
if (isset($_SESSION['login']['5']) && $_SESSION['login']['5'] == 2) {
echo " <a class='edit' href='functions/admin/edit.php?id=" . $pageNumber . " '>Edit</a>";
echo " <a class='delete' href='functions/admin/deletePost.php?id=" . $pageNumber . " '>Delete</a>";
} elseif (isset($_SESSION['login']['5']) && $_SESSION['login']['5'] == 1) {
echo " <a class='edit' href='functions/admin/edit.php?id=" . $pageNumber . " '>Edit</a>";
} else {
}
echo "</div>";
echo "</div>";
echo "</section>";
echo max($row);
if (count($row['paginaNummer']) == max($row)){
} else {
echo "<a href='/'><img src='<?php echo $path . $img ?>'alt=''/></a>";
}
echo "</section>";
}
}
echo "</div></div>";
?>
I won't get any further with this part I hope you can help me with this problem
It's hard to understand what you need. But try this query:
$countQuery = $db->prepare("SELECT paginaNummer AS max
FROM pages ORDER BY paginaNummer DESC LIMIT 1");
Or may be this:
$countQuery = $db->prepare("SELECT paginaNummer AS max
FROM pages ORDER BY id DESC LIMIT 1");
Update: this code changes instead of top:
<?php
include 'functions/image/functions.php';
$query = $db->prepare("SELECT * FROM pages");
$query->execute();
$maxrow = $query->rowCount();
$num_cols = 1;
$i = 0;
$imgList = getImagesFromDir($root . $path);
$img = getRandomFromArray($imgList);
$n = 0;
while($row = $query->fetch()) {
if(isset($row)) {
$n++;
echo "<section data-stellar-background-ratio='0.5'>";
echo "<div class='panelContainer'>";
echo "<div class='panel2'>";
echo "<div class='symbol3'></div>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</section>";
echo "<section class='wrapper'>";
echo "<div class='box'>";
echo "<div class='content'>";
echo $i++ % $num_cols == 0 ? '' : '';
echo "<div id='message'><h2> ", $row['berichtNaam'], "</h2>";
echo $row['paginaContent'], "<br />";
if (isset($_SESSION['login']['5']) && $_SESSION['login']['5'] == 2) {
echo " <a class='edit' href='functions/admin/edit.php?id=" . $pageNumber . " '>Edit</a>";
echo " <a class='delete' href='functions/admin/deletePost.php?id=" . $pageNumber . " '>Delete</a>";
} elseif (isset($_SESSION['login']['5']) && $_SESSION['login']['5'] == 1) {
echo " <a class='edit' href='functions/admin/edit.php?id=" . $pageNumber . " '>Edit</a>";
} else {
}
echo "</div>";
echo "</div>";
echo "</section>";
echo max($row);
if ($n == $maxrow){
} else {
echo "<a href='/'><img src='<?php echo $path . $img ?>'alt=''/></a>";
}
echo "</section>";
}
}
echo "</div></div>";
?>
Related
i tried. but it not success full.. please give me solution..
php code
<?php
function getReviews($con){
$sql = "SELECT * FROM review";
$result = mysql_query($sql,$con);
while ($row = mysql_fetch_array($result)) {
echo "<div class=' col-md-12 comment-box'>";
echo "<div class='left-comm col-md-2'>";
echo "<img class='img-responsive' src='images/article/avatar3.png'>";
echo "</div>";
echo "<div class='right-comm col-md-6'>";
echo "<p class='user-name'>".$row['email']."</p>";
echo for ($i=0; $i <$row['rating'] ; $i++) {
echo "*";
}"<br>";
echo $row['review']."<br>";
echo "</div>";
echo "</div><br>";
?>
i want to display rate value using stars.in this function.
Change:
echo for ($i=0; $i <$row['rating'] ; $i++) {
echo "*";
}"<br>";
to:
for ($i=0; $i <$row['rating'] ; $i++) {
echo "*";
}
echo "<br />";
I've been trying to figure this out on and off for a while, but I have a member based site that returns the same user regardless of the profile chosen and I'm not sure what's going on.
Here is my header
<?php
//START SESSION
ob_start();
session_start();
include_once 'functions.php';
if(isset($_SESSION['email']))
{
$email = $_SESSION['email'];
$loggedin = TRUE;
$userstr = " $email";
} else {
$loggedin = FALSE;
}
if($loggedin) {
include_once "navIn.php";
} else {
include_once "navOut.php";
}
This is my function that actually returns the user profile.
function showProfile($email)
{
if(file_exists("users/$row[0]/$row[0]pi.jpg"))
echo "<img src='/users/$row[0]/$row[0]pi.jpg'>";
else
echo "<i id='user-img-dflt' class='fa fa-user' aria-hidden='true'></i><br>";
$result = queryMysql("SELECT * FROM profiles");
if(mysql_num_rows($result))
{
$row = mysql_fetch_row($result);
echo "Contact: $row[3]";
echo "<h4>Statement</h4>";
echo "<p>";
echo stripcslashes($row[2]) . "<br clear='left' /><br/>";
echo "</p>";
echo "<h4>Work</h4>";
echo "<div class='gallery row'>";
//image1
if(file_exists("users/$row[0]/work/$row[0]w1.jpg"))
echo "<div class='col-md-2'>".
"<a href='/users/$row[0]/work/$row[0]w1.jpg'>" .
"<img class='thumbnail' src='/users/$row[0]/work/$row[0]w1.jpg'>" .
"</a>" .
"</div>";
else
echo "<div class='col-md-2'></div>";
//image2
if(file_exists("users/$row[0]/work/$row[0]w2.jpg")) {
echo "<div class='col-md-2'>".
"<a href='/users/$row[0]/work/$row[0]w2.jpg'>" .
"<img class='thumbnail' src='/users/$row[0]/work/$row[0]w2.jpg'>" .
"</a>" .
"</div>";
} else {
echo "<div class='col-md-2'></div>";
}
//image3
if(file_exists("users/$row[0]/work/$row[0]w3.jpg")) {
echo "<div class='col-md-2'>".
"<a href='/users/$row[0]/work/$row[0]w3.jpg'>" .
"<img class='thumbnail' src='/users/$row[0]/work/$row[0]w3.jpg'>" .
"</a>" .
"</div>";
} else {
echo "<div class='col-md-2'></div>";
}
//image4
if(file_exists("users/$row[0]/work/$row[0]w4.jpg")) {
echo "<div class='col-md-2'>".
"<a href='/users/$row[0]/work/$row[0]w4.jpg'>" .
"<img class='thumbnail' src='/users/$row[0]/work/$row[0]w4.jpg'>" .
"</a>" .
"</div>";
} else {
echo "<div class='col-md-2'></div>";
}
//image5
if(file_exists("users/$row[0]/work/$row[0]w5.jpg")) {
echo "<div class='col-md-2'>".
"<a href='/users/$row[0]/work/$row[0]w5.jpg'>" .
"<img class='thumbnail' src='/users/$row[0]/work/$row[0]w5.jpg'>" .
"</a>" .
"</div>";
} else {
echo "<div class='col-md-2'></div>";
}
//image6
if(file_exists("users/$row[0]/work/$row[0]w6.jpg")) {
echo "<div class='col-md-2'>".
"<a href='/users/$row[0]/work/$row[0]w6.jpg'>" .
"<img class='thumbnail' src='/users/$row[0]/work/$row[0]w6.jpg'>" .
"</a>" .
"</div>";
} else {
echo "<div class='col-md-2'></div>";
}
echo "</div>";
}
}
Lastly here is my members page that displays members and allows you to click on the profile.
<?php
//members.php
include_once 'head.php';
echo "<div id='content' class='container'>";
if(isset($_GET['view']))
{
$view = sanitizeString($_GET['view']);
$result = queryMysql("SELECT * FROM members");
$row = mysql_fetch_row($result);
echo "<h3>$row[2] $row[3]</h3>";
showProfile($view);
echo "</div>";
include_once 'footer.php';
die();
}
$stuff = queryMysql("SELECT * FROM members");
$num = mysql_num_rows($stuff);
echo "<h3>Members</h3>";
echo "<div class='row'>";
for ($j = 0; $j < $num; ++$j)
{
$row = mysql_fetch_row($stuff);
if($row[1] == $email) continue;
if(file_exists("users/$row[0]/$row[0]pi.jpg")) {
echo "<div class='col-md-4'><a href='?view=$row[0]'><img src='/users/$row[0]/$row[0]pi.jpg'/> <br>$row[2] $row[3] </a></div>";
}
else {
echo "<div class='col-md-4'><a href='?view=$row[0]'><i id='user-img-dflt' class='fa fa-user' aria-hidden='true'></i> <br>$row[2] $row[3] </a></div>";
}
}
echo "</div>";
echo "</div>";
?>
<?php include_once 'footer.php'; ?>
My MySQL database is pretty simple it has two tables:
members[id, email, firstName, lastName, pass]
profiles[id, statement, contact, website]
When I click on another profile the view id is correct but the profile remains regardless.
Figured it out thanks to the comments posted.
In my showProfile function:
$result = queryMysql("SELECT * FROM profiles WHERE id='$id'");
And in my members page:
$result = queryMysql("SELECT * FROM members WHERE id = '$view'");
my goal is to display related articles below a post (check if available, then loop through the ones that are there). It works fine if I have 3 or 6 setup but if I have only 5, it displays automatically the original post as the sixth related article.
echo "<div class='related-posts'>";
$related_articles = get_field('related_articles', false, false);
$id = $related_articles[0];
if($id) {
echo "<h5 class='related-posts_h'>Ähnliche Artikel, die du lesen musst</h5>";
echo "<ul class='related-posts_list clearfix'>";
for ($i=1; $i <= 6; $i++) {
$id = $related_articles[$i-1];
if ( has_post_thumbnail($id) ) {
echo "<li class='related-posts_item'>";
echo "<figure class='featured-thumbnail thumbnail large'>";
echo "<div class='hider-page'></div>";
echo "<a href='".get_permalink($id)." title='".get_the_title($id)."'>";
echo get_the_post_thumbnail( $id, 'medium-thumb' );
echo "<span class='zoom-icon'></span>";
echo "</a>";
echo "</figure>";
} else {
"<figure class='thumbnail featured-thumbnail'>";
echo "<div class='hider-page'></div>";
echo "<a href='".get_permalink($id)."' title='".get_the_title($id)."'>";
echo "<img src='".get_template_directory_uri()."/images/empty_thumb.gif' alt='".get_the_title($id)."' />";
echo "</a>";
echo "</figure>";
}
echo "<h6><a href='".get_permalink($id)."'>";
echo get_the_title($id);
echo "</a>";
echo "</h6>";
echo "</li>";
}
echo "</ul>";
echo "</div><!-- .related-posts -->";
Try this.. check after the for loop whether the related Post ID is not equals to the original post ID then only display the related Posts
that is
$id = $related_articles[$i-1];
if(get_the_ID() != $id){
//then do the stuff
}
I Hope you are in the details or single.php page so you will get the ID of original post by get_the_ID()
echo "<div class='related-posts'>";
$related_articles = get_field('related_articles', false, false);
$id = $related_articles[0];
if($id) {
echo "<h5 class='related-posts_h'>Ähnliche Artikel, die du lesen musst</h5>";
echo "<ul class='related-posts_list clearfix'>";
for ($i=1; $i <= 6; $i++) {
$id = $related_articles[$i-1];
if(get_the_ID() != $id){
if ( has_post_thumbnail($id) ) {
echo "<li class='related-posts_item'>";
echo "<figure class='featured-thumbnail thumbnail large'>";
echo "<div class='hider-page'></div>";
echo "<a href='".get_permalink($id)." title='".get_the_title($id)."'>";
echo get_the_post_thumbnail( $id, 'medium-thumb' );
echo "<span class='zoom-icon'></span>";
echo "</a>";
echo "</figure>";
} else {
"<figure class='thumbnail featured-thumbnail'>";
echo "<div class='hider-page'></div>";
echo "<a href='".get_permalink($id)."' title='".get_the_title($id)."'>";
echo "<img src='".get_template_directory_uri()."/images/empty_thumb.gif' alt='".get_the_title($id)."' />";
echo "</a>";
echo "</figure>";
}
echo "<h6><a href='".get_permalink($id)."'>";
echo get_the_title($id);
echo "</a>";
echo "</h6>";
echo "</li>";
}
}
echo "</ul>";
echo "</div><!-- .related-posts -->";
My issue is that when I try to access my cart after adding products to it I keep getting the same error,
"mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean
given"
with this line of code:
$itemnumrows = mysqli_num_rows($itemsresult);
<?php
function showcart()
{
require('connect.php');
if (isset($_SESSION['SESS_ORDERNUM'])) {
if (isset($_SESSION['SESS_LOGGEDIN'])) {
$custquery = "SELECT id, status from orders WHERE customer_id = " . $_SESSION['SESS_USERID'] . " AND status < 2;";
$custresult = mysqli_query($con, $custquery);
$custrow = mysqli_fetch_assoc($custresult);
$itemsquery = "SELECT products.*, orderitems.*, orderitems.id AS itemid FROM products, orderitems WHERE orderitems.product_id =products.id AND order_id = " . $custrow['id'];
$itemsresult = mysqli_query($con, $itemsquery);
$itemnumrows = mysqli_num_rows($itemsresult);
} else {
$custquery = "SELECT id, status from orders WHERE session = '" . session_id() . "' AND status < 2;";
$custresult = mysqli_query($con, $custquery);
$custrow = mysqli_fetch_assoc($custresult);
$itemsquery = "SELECT products.*, orderitems.*, orderitems.id AS itemid FROM products, orderitems WHERE orderitems.product_id = products.id AND order_id = " . $custrow['id'];
$itemsresult = mysqli_query($con, $itemsquery);
$itemnumrows = mysqli_num_rows($itemsresult);
}
} else {
$itemnumrows = 0;
}
if ($itemnumrows == 0) {
echo "You have not added anything to your shopping cart yet.";
} else {
echo "<table cellpadding='10'>";
echo "<tr>";
echo "<td></td>";
echo "<td><strong>Item</strong></td>";
echo "<td><strong>Quantity</strong></td>";
echo "<td><strong>Unit Price</strong></td>";
echo "<td><strong>Total Price</strong></td>";
echo "<td></td>";
echo "</tr>";
while ($itemsrow = mysqli_fetch_assoc($itemsresult)) {
$quantitytotal = $itemsrow['price'] * $itemsrow['quantity'];
echo "<tr>";
if (empty($itemsrow['image'])) {
echo "<td><img src='productimages/dummy.jpg' width='50' alt='" . $itemsrow['name'] . "'></td>";
} else {
echo "<td><img src='productimages/" . $itemsrow['image'] . "' width='50' alt='" . $itemsrow['name'] . "'></td>";
}
echo "<td>" . $itemsrow['name'] . "</td>";
echo "<td>" . $itemsrow['quantity'] . "</td>";
echo "<td><strong>£" . sprintf('%.2f', $itemsrow['price']) . "</strong></td>";
echo "<td><strong>£" . sprintf('%.2f', $quantitytotal) . "</strong></td>";
echo "<td>[<a href='delete.php?id=" . $itemsrow['itemid'] . "'>X</a>]</td>";
echo "</tr>";
#$total = $total + $quantitytotal;
$totalquery = "UPDATE orders SET total = " . $total . " WHERE id = " . $_SESSION['SESS_ORDERNUM'];
$totalresult = mysqli_query($con, $totalquery);
}
echo "<tr>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td>TOTAL</td>";
echo "<td><strong>£" . sprintf('%.2f', $total) . "</strong></td>";
echo "<td></td>";
echo "</tr>";
echo "</table>";
echo "<p><a href='checkout.php'>Go to the checkout</a></p>";
}
}
?>
Heres my showcart page, also getting the same error with this line:
$numrows = mysqli_num_rows($result);
<?php
session_start();
require("header.php");
require("functions.php");
echo "<h1>Your shopping cart</h1>";
showcart();
if (isset($_SESSION['SESS_ORDERNUM']) == TRUE) {
$query = "SELECT * FROM orderitems WHERE order_id = " . $_SESSION['SESS_ORDERNUM'] . ";";
$result = mysqli_query($con, $query);
$numrows = mysqli_num_rows($result);
if ($numrows >= 1) {
echo "<h2><a href='checkout.php'>Go to the checkout</a></h2>";
}
}
require("footer.php");
?>
My header page as well, when I click the viewcart link it outputs same errors as above blocks of code..
<?php
if (!isset($_SESSION)) {
session_start();
}
if (isset($_SESSION['SESS_CHANGEID']) == TRUE) {
session_unset();
session_regenerate_id();
}
include("connect.php");
?>
<html>
<head>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="header">
<h1 style="color:#ffffff"> <?php echo $site; ?> </h1>
</div>
<div id="menu">
Home
View Basket/Checkout</div>
<div id="container">
<div id="bar">
<?php
include("bar.php");
echo "<hr />";
if (isset($_SESSION['SESS_LOGGEDIN']) == TRUE) {
echo "Logged in as <strong>'" . $_SESSION['SESS_USERNAME'] . "'</strong>[<a href='" . $access . "logout.php'>logout</a>]";
} else {
echo "<a href='" . $access . "login.php'>Login</a>";
} ?></div>
<div id="main">
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
I have been trying to tackle this problem for many hours.
i feel its something as simple as how the if statement should work.
Bellow is my code that i am trying to add to: And underneath that code i have typed the php that i tried to use: But i keep getting errors regarding to the structure of the if statement?
Additionally I believe my code itself is at fault, as this error only happens when I insert my code. To confirm this is the pseudo:
If sort parameter exists in URL then use the value when selecting the table. Otherwise use the non order sql.
-----------Trying to edit----------
if (isset($_GET[sort])) {
$sorting = $_GET['sort'];
$result = $mysqli->query("SELECT * FROM routes ORDER BY $sorting");
}
else {
$result = $mysqli->query("SELECT * FROM routes");
}
-----------Trying to edit----------
if ($result->num_rows != 0)
{
$total_results = $result->num_rows;
$total_pages = ceil($total_results / $per_page);
if (isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] <= $total_pages )
{
$show_page = $_GET['page'];
if ($show_page > 0 && $show_page <= $total_pages)
{
$start = ($show_page -1) * $per_page;
$end = $start + $per_page;
}
else
{
$start = 0;
$end = $per_page;
}
}
else
{
$start = 0;
$end = $per_page;
}
echo "<form action='../processors/delete.php' method='post'";
echo "<br/><table class='table table-striped table-bordered' id='basic-datatable' border='0' cellpadding='10'>";
echo "<thead><tr> <th>#</th>";
echo "<th><a href='adminviewer.php?sort=route_id'>Route ID</a></th>";
echo "<th><a href='adminviewer.php?sort=route_name'>Route</a></th>";
echo "<th><a href='adminviewer.php?sort=route_price'>Price</a></th>";
echo "<th><a href='adminviewer.php?sort=route_payment'>Payment</a></th>";
echo "<th><a href='adminviewer.php?sort=route_net'>Weekly Net</a></th>";
echo "<th><a href='adminviewer.php?sort=route_city'>City</a></th>";
echo "<th><a href='adminviewer.php?sort=route_state'>State</a></th>";
echo "<th><a href='adminviewer.php?sort=route_remarks'>Remarks</a></th>";
echo "</tr></thead>";
echo "<tbody>";
for ($i = $start; $i < $end; $i++)
{
if ($i == $total_results) { break; }
$result->data_seek($i);
$row = $result->fetch_row();
echo "<tr>";
echo '<td><input class="checked-box" type="checkbox" name="selec-row[]" value="' . $row[0] . '"></td>';
echo '<td>' . $row[1] . '</td>';
echo '<td>' . $row[2] . '</td>';
echo '<td>' . $row[3] . '</td>';
echo '<td>' . $row[4] . '</td>';
echo '<td>' . $row[5] . '</td>';
echo '<td>' . $row[6] . '</td>';
echo '<td>' . $row[7] . '</td>';
echo '<td>' . $row[8] . '</td>';
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo "<input class='del-btn' type='submit' value='Delete'>";
echo "</form>";
}
else
{
echo "No results to display!";
}
echo '<div class="col-md-12" style="text-align: center;position:relative;top:-25px;">';
echo "Showing 1 to " . $per_page . " of " . $total_results . " routes";
echo '</div>';
echo "</div>";
echo '</div>';
echo '</div>';
echo '</div>';
echo '<div class="pagination">';
if (!isset($_GET['page'])) {
$_GET['page'] = 1;
}
if ($_GET['page'] > $per_page) {
$next_page = $i - 1;
echo "<div class='pag-btn'><a href='adminviewer.php?page=$next_page&page_sel=$per_page'><- Previous</a></div>";
}
else {
echo "<div class='pag-btn'>Previous</div>";
}
if ($_GET['page'] < $total_pages) {
$next_page = $_GET['page'] + 1;
echo "<div class='pag-btn'><a href='adminviewer.php?page=$next_page&page_sel=$per_page'>Next -></a></div>";
}
else {
echo "<div class='pag-btn'>Next</div>";
}
echo '</div>';
}
else -----syntax error, unexpected '}'----
{
echo "Error: " . $mysqli->error;
}
if(isset($_GET['sort'])) {
$sorting = sanitize_input($_GET['sort']);
$result = mysqli->query("SELECT * FROM table ORDER BY $sorting");
} else {
$result = mysqli->query("SELECT * FROM table ORDER BY id");
}
I have looked over the code and i cant see issues with the statement. PHP is telling me errors like unexpected } and when i remove that its like unexpected else etc.
Please share some light on this that would be great, as well as any general structural improvements if you see any :)
Error Code: Parse error: syntax error, unexpected '}'
I'm still learning so my critiquing.
Elevant
I think you have an else without an opening if statement, check this out (in last lines of the script), made the test with your edit and get the same
<?php
// -----------Trying to edit----------
if (isset( $_GET[sort]) )
{
$sorting = $_GET['sort'];
$result = $mysqli->query("SELECT * FROM routes ORDER BY $sorting");
} else {
$result = $mysqli->query("SELECT * FROM routes");
}
// -----------Trying to edit----------
if ($result->num_rows != 0)
{
$total_results = $result->num_rows;
$total_pages = ceil($total_results / $per_page);
if (isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] <= $total_pages )
{
$show_page = $_GET['page'];
if ($show_page > 0 && $show_page <= $total_pages)
{
$start = ($show_page -1) * $per_page;
$end = $start + $per_page;
} else {
$start = 0;
$end = $per_page;
}
} else {
$start = 0;
$end = $per_page;
}
echo "<form action='../processors/delete.php' method='post'";
echo "<br/><table class='table table-striped table-bordered' id='basic-datatable' border='0' cellpadding='10'>";
echo "<thead><tr> <th>#</th>";
echo "<th><a href='adminviewer.php?sort=route_id'>Route ID</a></th>";
echo "<th><a href='adminviewer.php?sort=route_name'>Route</a></th>";
echo "<th><a href='adminviewer.php?sort=route_price'>Price</a></th>";
echo "<th><a href='adminviewer.php?sort=route_payment'>Payment</a></th>";
echo "<th><a href='adminviewer.php?sort=route_net'>Weekly Net</a></th>";
echo "<th><a href='adminviewer.php?sort=route_city'>City</a></th>";
echo "<th><a href='adminviewer.php?sort=route_state'>State</a></th>";
echo "<th><a href='adminviewer.php?sort=route_remarks'>Remarks</a></th>";
echo "</tr></thead>";
echo "<tbody>";
for ($i = $start; $i < $end; $i++)
{
if ($i == $total_results)
{
break;
}
$result->data_seek($i);
$row = $result->fetch_row();
echo "<tr>";
echo '<td><input class="checked-box" type="checkbox" name="selec-row[]" value="' . $row[0] . '"></td>';
echo '<td>' . $row[1] . '</td>';
echo '<td>' . $row[2] . '</td>';
echo '<td>' . $row[3] . '</td>';
echo '<td>' . $row[4] . '</td>';
echo '<td>' . $row[5] . '</td>';
echo '<td>' . $row[6] . '</td>';
echo '<td>' . $row[7] . '</td>';
echo '<td>' . $row[8] . '</td>';
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo "<input class='del-btn' type='submit' value='Delete'>";
echo "</form>";
} else {
echo "No results to display!";
}
echo '<div class="col-md-12" style="text-align: center;position:relative;top:-25px;">';
echo "Showing 1 to " . $per_page . " of " . $total_results . " routes";
echo '</div>';
echo "</div>";
echo '</div>';
echo '</div>';
echo '</div>';
echo '<div class="pagination">';
if ( !isset($_GET['page']) )
{
$_GET['page'] = 1;
}
if ($_GET['page'] > $per_page)
{
$next_page = $i - 1;
echo "<div class='pag-btn'><a href='adminviewer.php?page=$next_page&page_sel=$per_page'><- Previous</a></div>";
} else {
echo "<div class='pag-btn'>Previous</div>";
}
if ($_GET['page'] < $total_pages)
{
$next_page = $_GET['page'] + 1;
echo "<div class='pag-btn'><a href='adminviewer.php?page=$next_page&page_sel=$per_page'>Next -></a></div>";
} else {
echo "<div class='pag-btn'>Next</div>";
}
echo '</div>';
/* The same thing, no opening if statement. Sure this is not the error?
}
else -----syntax error, unexpected '}'----
{
echo "Error: " . $mysqli->error;
}
**/
?>
Hope this helps :)