amxbans [LAST BAN]Paskutinis banas

Forumas skirtas klausimams/pamokoms susijusioms su PHP, SQL (MySQL), web technologijomis, HTML, CSS, javascript, turinio valdymo sistemomis ir kita.
Post Reply
User avatar
popilas
Gana aktyvus vartotojas
Posts: 401
Joined: 2017 Apr 04 11:44
Location: Alytus

amxbans [LAST BAN]Paskutinis banas

Post by popilas »

Sveiki, ar eina kazkaip isgauti koda kad tiesiogiai rodytu LAST BAN (paskutinis banas)
HTML butu include i foruma
Attachments
lastban.png
lastban.png (4.58 KiB) Viewed 11008 times
PATYLĖK!!! Bent protingesnis atrodysi :)

horde
Ar jis surinks 50 žinučių?
Posts: 37
Joined: 2017 Feb 28 11:49

Re: amxbans [LAST BAN]Paskutinis banas

Post by horde »

Žinoma kad eina
Ark'xes // firefly.lt

User avatar
popilas
Gana aktyvus vartotojas
Posts: 401
Joined: 2017 Apr 04 11:44
Location: Alytus

Re: amxbans [LAST BAN]Paskutinis banas

Post by popilas »

horde wrote:Žinoma kad eina
placiau? :D

-- 2018 Rgp 29 17:42 --
horde wrote:Žinoma kad eina
placiau? :D
PATYLĖK!!! Bent protingesnis atrodysi :)

horde
Ar jis surinks 50 žinučių?
Posts: 37
Joined: 2017 Feb 28 11:49

Re: amxbans [LAST BAN]Paskutinis banas

Post by horde »

PHP pagalba siunti SQL užklausa kuri rikiuoja pagal paskutinio bano laiką (ORDER BY) ir padarai LIMIT 1. Susikrauni info į kintamąjį ir atvaizduoji. Jei nesupratai tada reiktų pradėt nuo pagrindų PHP/SQL.
Ark'xes // firefly.lt

User avatar
psychical
Viršininkas
Posts: 2094
Joined: 2011 Mar 12 22:19
Skype: tautvydas11
Location: Linksmakalnis
Contact:

Re: amxbans [LAST BAN]Paskutinis banas

Post by psychical »

Code: Select all

<?php $mysqli = new mysqli("hostname", "username", "password", "database"); //Jungiames prie duomenu bazes if ($mysqli->connect_error) {    die('Connect Error ('.$mysqli->connect_errno.')'.$mysqli->connect_error);} $result = $mysqli->query("SELECT * FROM `amx_bans` ORDER BY `bid` DESC LIMIT 1"); //Gaunam banu informacija if($result->num_rows): //Tikrinam ar bent vienas banas iš vis yra    $obj = $result->fetch_object(); //Gaunam informacija apie bana    ?><table border=1>        <tr>            <td>Žaidejas</td>            <td style="text-align: right;"><?php echo $obj->player_nick; ?></td>        </tr>        <tr>            <td>SteamID</td>            <td style="text-align: right;">Negalima</td>        </tr>        <tr>            <td>Žaidejas</td>            <td style="text-align: right;"><?php echo $obj->ban_reason; ?></td>        </tr>        <tr>            <td>Data</td>            <td style="text-align: right;"><?php echo date("Y-m-d H:i", $obj->ban_created); ?></td>        </tr>        <tr>            <td>Pasibaigs</td>            <td style="text-align: right;">                <?php echo ($obj->ban_length <= 0) ? "niekada" : date("Y-m-d H:i", ($obj->ban_created + ($obj->ban_length * 60))); ?>            </td>        </tr>    </table><?phpelse: //Jei banu iš vis nera     ?>Banu nera!<?phpendif;

User avatar
popilas
Gana aktyvus vartotojas
Posts: 401
Joined: 2017 Apr 04 11:44
Location: Alytus

Re: amxbans [LAST BAN]Paskutinis banas

Post by popilas »

psychical wrote:

Code: Select all

<?php $mysqli = new mysqli("hostname", "username", "password", "database"); //Jungiames prie duomenu bazes if ($mysqli->connect_error) {    die('Connect Error ('.$mysqli->connect_errno.')'.$mysqli->connect_error);} $result = $mysqli->query("SELECT * FROM `amx_bans` ORDER BY `bid` DESC LIMIT 1"); //Gaunam banu informacija if($result->num_rows): //Tikrinam ar bent vienas banas iš vis yra    $obj = $result->fetch_object(); //Gaunam informacija apie bana    ?><table border=1>        <tr>            <td>Žaidejas</td>            <td style="text-align: right;"><?php echo $obj->player_nick; ?></td>        </tr>        <tr>            <td>SteamID</td>            <td style="text-align: right;">Negalima</td>        </tr>        <tr>            <td>Žaidejas</td>            <td style="text-align: right;"><?php echo $obj->ban_reason; ?></td>        </tr>        <tr>            <td>Data</td>            <td style="text-align: right;"><?php echo date("Y-m-d H:i", $obj->ban_created); ?></td>        </tr>        <tr>            <td>Pasibaigs</td>            <td style="text-align: right;">                <?php echo ($obj->ban_length <= 0) ? "niekada" : date("Y-m-d H:i", ($obj->ban_created + ($obj->ban_length * 60))); ?>            </td>        </tr>    </table><?phpelse: //Jei banu iš vis nera     ?>Banu nera!<?phpendif;

Aciu
PATYLĖK!!! Bent protingesnis atrodysi :)

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests