Ajutor afisare php

Discutii despre tot ce nu se incadreaza in celelalte categorii.

Moderators: Moderatori ajutatori, Moderatori

Post Reply
User avatar
Mafios_X
Fost administrator
Fost administrator
Posts: 6851
Joined: 10 Apr 2009, 01:28
Detinator Steam: Da
SteamID: mafiosx
Reputatie: Fost Administrator
Location: Italia
Has thanked: 341 times
Been thanked: 419 times
Contact:

05 Dec 2017, 20:23

Deci am tabelele astea de jos :
Image

Vreau sa afisez un text pe o pagina cu suma totala a banilor din wallet, suma totala a banilor din bank din tabela money (toti banii de pe server cum ar fi din wallet si toti banii de pe server din bank) si sa expun cel mai bogat jucator cu numele lui folosind idul sa pot extrage din tabela identity firstname si name!

Stiu ca este ceva usor pentru unii, dar eu nu am mai pus mana pe php de cativa ani :))! :omfg:
-------------------------------#STEAM PROFILE--------------------------------------
Image
STEAM: mafiosx

Image


www.gamescan.ro - Un fel de GameTracker ROMANESC :D
RoyalServer
The Kalu
Fost administrator
Fost administrator
Posts: 13713
Joined: 09 Oct 2010, 12:39
Detinator Steam: Da
CS Status: In grajd!
SteamID: kalulord
Reputatie: Fost Administrator
Fost membru Club eXtreamCS (6 luni)
Nume anterior: Terra
Location: Romania, Ploiesti
Has thanked: 328 times
Been thanked: 646 times
Contact:

05 Dec 2017, 20:43

Netestat!

Descarci de aici clasa mysql: https://raw.githubusercontent.com/Thing ... sqliDb.php

Code: Select all

<?php

require_once ('MysqliDb.php');

$db = new MysqliDb (Array (
                'host' => 'host',
                'username' => 'username', 
                'password' => 'password',
                'db'=> 'databaseName',
                'port' => 3306,
                'prefix' => 'my_',
                'charset' => 'utf8'));


$richppl =  $db->rawQueryValue ('SELECT table1.user_id, MAX(table1.wallet) AS MAXWALLET, MAX(table1.bank) AS MAXBANK, identity.firstname, identity.name 
FROM table1
INNER JOIN identity ON table1.user_id = identity.user_id
LIMIT 10');

    foreach ($richppl => $key) {
        print_r($key);

            
            print 'The richest user with wallet is: '.$key['name'].' with '.$key['maxwallet'].'';
            
    }


?>
Image
User avatar
Mafios_X
Fost administrator
Fost administrator
Posts: 6851
Joined: 10 Apr 2009, 01:28
Detinator Steam: Da
SteamID: mafiosx
Reputatie: Fost Administrator
Location: Italia
Has thanked: 341 times
Been thanked: 419 times
Contact:

07 Dec 2017, 21:07

firstname si name sunt in alta tabela numita altfel, nu cu banii!

Code: Select all

$richppl =  $db->rawQueryValue ('SELECT user_id, MAX(wallet) AS MAXWALLET, MAX(bank) AS MAXBANK FROM vrp_user_moneys
INNER JOIN vrp_user_identities ON user_id = identity.user_id
LIMIT 10');

    foreach ($richppl => $key) {
        print_r($key);

            
            print 'The richest user with wallet is: '.$key['name'].' with '.$key['maxwallet'].'';
Nu-mi functioneaza!
-------------------------------#STEAM PROFILE--------------------------------------
Image
STEAM: mafiosx

Image


www.gamescan.ro - Un fel de GameTracker ROMANESC :D
User avatar
Mafios_X
Fost administrator
Fost administrator
Posts: 6851
Joined: 10 Apr 2009, 01:28
Detinator Steam: Da
SteamID: mafiosx
Reputatie: Fost Administrator
Location: Italia
Has thanked: 341 times
Been thanked: 419 times
Contact:

13 Dec 2017, 19:51

Ma poate ajuta cineva? :)

Eventual sa extrag numele din baza de date! (platesc daca este nevoie, cautati-ma pe http://steamcommunity.com/id/mafios/ )
-------------------------------#STEAM PROFILE--------------------------------------
Image
STEAM: mafiosx

Image


www.gamescan.ro - Un fel de GameTracker ROMANESC :D
Filiq_
Utilizator neserios
Utilizator neserios
Posts: 847
Joined: 02 Nov 2014, 18:21
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Reputatie: Fost Scripter eXtreamCS
Utilizator neserios
Fond eXtream: 0
Location: Constanta
Has thanked: 40 times
Been thanked: 30 times

14 Dec 2017, 02:55

iti recomand sa folosesti conexiunea prin PDO este mult mai buna.

Un exemplu:

Code: Select all


<?php 
	$q = Config::$g_con->prepare("SELECT coloana FROM tabel WHERE coloana = 0"); // inclod de = 0 pui tu ce doresti
	$q->execute();

        echo $q->RowCount() afiseaza ce ai in $q adica mai sus

Config // clasa
g_con // este "variabila" prin care se face conexiunea ( nu stiu exact cum sa ii spun ) 
?>

Daca doresti ai un link in descriere cu un topic in care ofer servici php.
https://discord.gg/VABVdhXMrK ZM CSO server in working..
User avatar
Mafios_X
Fost administrator
Fost administrator
Posts: 6851
Joined: 10 Apr 2009, 01:28
Detinator Steam: Da
SteamID: mafiosx
Reputatie: Fost Administrator
Location: Italia
Has thanked: 341 times
Been thanked: 419 times
Contact:

27 Jan 2018, 11:26

Diversity wrote:iti recomand sa folosesti conexiunea prin PDO este mult mai buna.

Un exemplu:

Code: Select all


<?php 
	$q = Config::$g_con->prepare("SELECT coloana FROM tabel WHERE coloana = 0"); // inclod de = 0 pui tu ce doresti
	$q->execute();

        echo $q->RowCount() afiseaza ce ai in $q adica mai sus

Config // clasa
g_con // este "variabila" prin care se face conexiunea ( nu stiu exact cum sa ii spun ) 
?>

Daca doresti ai un link in descriere cu un topic in care ofer servici php.

Ti-am trimis un PM!
-------------------------------#STEAM PROFILE--------------------------------------
Image
STEAM: mafiosx

Image


www.gamescan.ro - Un fel de GameTracker ROMANESC :D
User avatar
HeliosET
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 611
Joined: 17 Nov 2014, 23:29
Detinator Steam: Da
Reputatie: Fost Membru Club eXtreamCS (doua luni)
Nume anterior: denisu3492
Utilizator neserios (tepar)
Fond eXtream: 0
Has thanked: 4 times

27 Jan 2018, 12:31

Dacă ești dispus să plătești îmi dai PM cu cât oferi.
peeeeepsi
Membru, skill +1
Membru, skill +1
Posts: 243
Joined: 27 Jun 2012, 22:09
Detinator Steam: Da
Has thanked: 6 times
Been thanked: 5 times

27 Jan 2018, 16:53

User avatar
Hades Ownage
Membru eXtream
Membru eXtream
Posts: 3182
Joined: 22 Oct 2008, 10:12
Detinator Steam: Da
Detinator server CS: jb.clutch.ro
SteamID: hades-source
Reputatie: Fost Super Moderator
Fost Scripter eXtreamCS
Nume anterior: hadesownage
Location: Iasi
Has thanked: 324 times
Been thanked: 406 times

27 Jan 2018, 19:17

Code: Select all

SELECT MAX(m.wallet) as total_money, (SELECT user_id FROM money ORDER BY wallet DESC LIMIT 1) as highest, i.firstname, i.name FROM money m LEFT OUTER JOIN identity i ON i.user_id = highest
ceva in genul ar trebui sa vina, nu cred ca o sa functioneze deoarece nu stiu exact structura tabelelor
Post Reply

Return to “Discutii generale”

  • Information