Saldo uit Mysql halen

Gestart doorBartv7 reacties50 weergaven

8 berichten · pagina 1 van 1

Bartv

Lid · Topicstarter

Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoe haal ik het saldo van je gebruiker uit de database?
zodat er staat: Saldo: (punten)
ik heb het script van Rik (GLS2)
en precies dezelfde vraag met je gebruikersnaam
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// Logged in[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]]))
{[/COLOR]


            [COLOR= #FF8000]// gegevens ophalen[/COLOR]
               [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT uName, uCoins, uPosts, uRangN FROM member_accounts WHERE uId = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]]);[/COLOR]
            [COLOR= #0000BB]$fetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br />U bent ingelogd als:<br /> [/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uName[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]<br />Rang: [/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uRangN[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]<br />Forumposts: [/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uPosts[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]<br />U heeft [/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uCoins[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000] punten.[/COLOR][COLOR= #007700];[/COLOR]
?>


komt uit mijn website, volgorde kan je natuurlijk zelf aanpassen.
0
Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
$i = 1;
$sql = "SELECT ,saldo, FROM naam ORDER BY saldo DESC LIMIT 0,5";
$query = mysql_query($sql);
while($rij = mysql_fetch_object($query)) {
$saldo = $rij->saldo;
echo "n";
echo "".$i."n";
echo "je hebt ".$saldo." puntenn";
echo "n";
$i++;
}
?>

saldo waar die saldo staat en naam waar de table is

edit:
marjolein was eerst
0
Bartv

Lid · Topicstarter

Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
en me logout.php werkt niet meer,
ik heb die fix wel gedaan in dat topic
kan iemand de logout.php sturen? of hier plaatsen?
btw bedankt marjolein, ik had het super erg nodig!
0
Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
geef de logout eens
0
Bartv

Lid · Topicstarter

Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]is_auth[COLOR= #007700]([/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]]))
{[/COLOR]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE member_accounts SET uOnline = 0 WHERE uId ="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]]);[/COLOR]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DELETE FROM member_sessions WHERE uHash = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uHash[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/session_destroy"]session_destroy[/URL][COLOR= #007700]();[/COLOR]
    [URL="http://www.php.net/setcookie"]setcookie[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"uHash"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/time"]time[/URL][COLOR= #007700]()-[/COLOR][COLOR= #0000BB]60[/COLOR][COLOR= #007700]*[/COLOR][COLOR= #0000BB]60[/COLOR][COLOR= #007700]*[/COLOR][COLOR= #0000BB]24[/COLOR][COLOR= #007700]*[/COLOR][COLOR= #0000BB]7[/COLOR][COLOR= #007700]);[/COLOR] 
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div class="greenerror">U bent nu uitgelogd en word doorverwezen naar de <a href="index.php">home.</a></div>[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<meta http-equiv="refresh" content="3;url=index.php">[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div class="rederror">U moet eerst inloggen voordat u kunt uitloggen</div>[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Als je eventjes wacht stuur ik hem via PB.
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rik schreef:
Als je eventjes wacht stuur ik hem via PB.
heb ik net al gedaan yummie
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren