Solved: 8 Years, 1 Week ago Page Shows only one entry from array.
#11
Solved: 8 Years, 1 Week ago
(2016-07-21, 03:08 PM)Sazze Wrote: You can use LIMIT.

$sql = "SELECT player_nick, admin_nick, ban_reason FROM acs__bans LIMIT 30

Ok thats great idea thanks allot

Right now it displays recent values at bottom how i can change it.
I want recent values to be displayed on top.
Reply
#12
Solved: 8 Years, 1 Week ago
If you want to display recent, order it by date. For example:

$sql = "SELECT player_nick, admin_nick, ban_reason FROM acs__bans ORDER BY date DESC LIMIT 30

Please note you need a column named 'date' to make this query work.
Reply
#13
Solved: 8 Years, 1 Week ago
(2016-07-22, 03:27 PM)Sazze Wrote: If you want to display recent, order it by date. For example:

$sql = "SELECT player_nick, admin_nick, ban_reason FROM acs__bans ORDER BY date DESC LIMIT 30

Please note you need a column named 'date' to make this query work.

Ok i'll try thanks allot for your valuable time...
Reply
#14
Solved: 8 Years, 1 Week ago
I need
Reply
#15
Solved: 8 Years, 1 Week ago
Hi I have a problem

How to fix this


Attached Files Thumbnail(s)
   
Reply
#16
Solved: 8 Years, 1 Week ago
Could you post you banlist.php page please?
Reply
#17
Solved: 8 Years, 1 Week ago
(2017-01-24, 05:40 PM)SvePu Wrote: Could you post you banlist.php page please?

<?php 

define('IN_MYBB', 1); require "./global.php";

include_once("analyticstracking.php"); 
$min=30;
date_default_timezone_set("Asia/Kolkata'");
require_once("conn.php"); 
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
		$a=1;
		$sqlcount = "SELECT player_nick, admin_nick, ban_reason, ban_created, ban_length, expired FROM amx__bans";
	$resultcount = $conn->query($sqlcount);
		if (mysqli_num_rows($resultcount) > 0) {
			$page= ceil((mysqli_num_rows($resultcount)/$min));
				while(($a<=$page)){
					$linkgen="http://forum.inserver.in/banlist.php?display_page=".($a-1);
					eval("\$dividesql .= \"".$templates->get("banlist_dividesqlpage")."\";");
					$a++;
			}
		}

/*if($_GET["display_page"]< ($page-1)){
	//$linkgen="http://forum.inserver.in/banlist.php?display_page=".($_GET["display_page"]+1);
	eval("\$forward = \"".$templates->get("banlist_fw")."\";");
}*/
if($_GET["display_page"]!= null){
	$temp= $min*($_GET["display_page"]);
	if($_GET["display_page"] != 0){
			$linkgen="http://forum.inserver.in/banlist.php?display_page=".($_GET["display_page"]-1);
			eval("\$backward = \"".$templates->get("banlist_bw")."\";");
			if($_GET["display_page"]< ($page-1)){
				$linkgen="http://forum.inserver.in/banlist.php?display_page=".($_GET["display_page"]+1);
				eval("\$forward = \"".$templates->get("banlist_fw")."\";");
			}
		}
}

$sql = "SELECT player_nick, admin_nick, ban_reason, ban_created, ban_length FROM amx__bans ORDER BY ban_created DESC LIMIT $temp, $min ";
$result = $conn->query($sql);
if (mysqli_num_rows($result) > 0) {
	

    // output data of each row
	  while($row = mysqli_fetch_assoc($result)) {
		if($row["ban_length"] > -1){
			$fan= array("pn"=>htmlspecialchars($row["player_nick"]), 
					"reason"=>htmlspecialchars($row["ban_reason"]),
					"admin"=>htmlspecialchars($row["admin_nick"]), 
					"date"=> date(' j F Y', $row["ban_created"]) . ' ' . date("h:i A", $row["ban_created"]),
					"length"=>$row["ban_length"]
					);
				$alt_bg = alt_trow();
				eval("\$ban .= \"".$templates->get("banlist_player")."\";");
			}
	}
	
} else {
    echo "0 results";
}
$conn->close();
	
eval("\$banlist = \"".$templates->get("banlist")."\";");
output_page($banlist);
Reply
#18
Solved: 8 Years, 1 Week ago
Ok thx.....why you don't use MyBB integrated functions like multpage() for the pagination
=> https://crossreference.mybb.de/nav.html?....html#l981
Reply
#19
Solved: 8 Years, 1 Week ago
cant find such function there, can you tell me step by step how i can implement it? I am not aware about this
Reply
#20
Solved: 8 Years, 1 Week ago
Do you store the ban data in the same db (same db connection) like forum?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)