[GLS] - Saldo weergeven van gebruiker

Gestart doorVandijkdesign15 reacties56 weergaven

16 berichten · pagina 1 van 2

Vandijkdesign

Lid · Topicstarter

Berichten
753
Reputatie
0
Punten
0,06
Lid sinds
Laatst gezien
Hallo,

Ik ben bezig met een project dat mensen hun beltegoed kunnen inwisselen voor cash geld.
Ik gebruik hierbij het GLS systeem (niet alle functies).
Nou heb ik een pagina dat saldo.php heet.
Op deze pagina wil ik hebben te staan het ingewisseld beltegoed (cash saldo) van de desbetreffende gebruiker, en 2 linkjes om hun beltegoed in te wisselen.

Nou kan ik die linkjes er zelf wel neerzetten, maar met het saldo weergeven kom ik niet uit.

Heeft 1 van jullie enig idee hoe ik dit kan weergeven?

Bij pagina profiel.php staat ook het saldo van de gebruiker.
Dit wordt als volgende weergegeven in de php code:

echo <h1>Profiel weergeven</h1>;
        if(ctype_digit($_GET[id]))
        {
            $InfQuery = mysql_query("SELECT uName, uCoins, uLast, uRef, uRangN, uCol, uSite, uProfileText, uSignature, uAvatarUrl, uPosts, uRegDate FROM member_accounts WHERE uId = " . $_GET[id]);
            $InfAssoc = mysql_fetch_assoc($InfQuery);
            $total_coin = mysql_result(mysql_query("SELECT SUM(uCoins) FROM member_accounts"), 0);
            
            echo <tr><td><strong>Saldo:&nbsp;&nbsp;</strong></td><td>  . htmlentities($InfAssoc[uCoins]) .  <i>( . $percentage_of_coins . % van iedereen)</i></td></tr>;


*

* Hierbij heb ik een hoop weggelaten, denk aan : gebruikersnaam weergeven etc.

Kan iemand me hier bij helpen?

Geen privéberichten alsjeblieft, alleen hulp via een bericht in topic.
Zodat andere GLS gebruikers er misschien ook nog wat aan hebben wink
Groet,
Jvandijk.
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
$infAssoc[uCoins] ?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Even wat opmerkingen?
- Ik mis goede foutafhandeling op je $InfQuery
- Ik mis je single-quotes waar je GET variabele tussen hoort te staan inc. je mysql_real_escape_string()
- Als je SELECT SUM(uCoins) doet, hang er een alias-veld aan vast met AS:
SELECT SUM(uCoins) AS coins, zodat je later $infAssoc[coins] kan gebruiken.
- Geen inline queries op lijn 6. Hier valt geen goede nodige foutafhandeling mee te bouwen.
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
dit heb ik uit mijn GLS gesloopt:

[COLOR= #0000BB]<?php                    
$saldo_query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
        SELECT uCoins FROM member_accounts
        WHERE
            uId = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]])
        )[/COLOR] or [URL="http://www.php.net/trigger_error"]trigger_error[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo_query[/COLOR][COLOR= #007700]))
        {[/COLOR]
            
            [COLOR= #0000BB]$saldo[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo_query[/COLOR][COLOR= #007700]);[/COLOR]
?>
Puntensaldo: [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] format[COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uCoins[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]);[/COLOR] ?>
0
Vandijkdesign

Lid · Topicstarter

Berichten
753
Reputatie
0
Punten
0,06
Lid sinds
Laatst gezien
Marjolein schreef:
dit heb ik uit mijn GLS gesloopt:
[COLOR= #0000BB]<?php                    
$saldo_query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
        SELECT uCoins FROM member_accounts
        WHERE
            uId = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]])
        )[/COLOR] or [URL="http://www.php.net/trigger_error"]trigger_error[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo_query[/COLOR][COLOR= #007700]))
        {[/COLOR]
            
            [COLOR= #0000BB]$saldo[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo_query[/COLOR][COLOR= #007700]);[/COLOR]
?>
Puntensaldo: [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] format[COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uCoins[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]);[/COLOR] ?>


Hier krijg ik de melding:

Parse error: syntax error, unexpected $end in /home/vandijk/domains/btg4cash.nl/public_html/pages/saldo.php on line 13
0
Berichten
6.356
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php                    
$saldo_query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
        SELECT uCoins FROM member_accounts
        WHERE
            uId = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]])
        )[/COLOR] or [URL="http://www.php.net/trigger_error"]trigger_error[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo_query[/COLOR][COLOR= #007700]))
        {[/COLOR]
            
            [COLOR= #0000BB]$saldo[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo_query[/COLOR][COLOR= #007700]);
        }[/COLOR]

?>
Puntensaldo: [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] format[COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uCoins[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]);[/COLOR] ?>


toevoeging op 10 april 2012, 191226:
Er was een } vergeten.
0
Vandijkdesign

Lid · Topicstarter

Berichten
753
Reputatie
0
Punten
0,06
Lid sinds
Laatst gezien
Mikeb schreef:
[COLOR= #0000BB]<?php                    
$saldo_query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
        SELECT uCoins FROM member_accounts
        WHERE
            uId = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]])
        )[/COLOR] or [URL="http://www.php.net/trigger_error"]trigger_error[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo_query[/COLOR][COLOR= #007700]))
        {[/COLOR]
            
            [COLOR= #0000BB]$saldo[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo_query[/COLOR][COLOR= #007700]);
        }[/COLOR]

?>
Puntensaldo: [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] format[COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uCoins[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]);[/COLOR] ?>
toevoeging op 10 april 2012, 191226:
Er was een } vergeten.

Nu krijg ik:
Fatal error: Call to undefined function format() in /home/vandijk/domains/btg4cash.nl/public_html/saldo.php on line 16
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
oh oke, dan moet je die format er uithalen (vergeten dat mijn gls wat uitgebreider is):
Puntensaldo:
0
Vandijkdesign

Lid · Topicstarter

Berichten
753
Reputatie
0
Punten
0,06
Lid sinds
Laatst gezien
Marjolein schreef:
oh oke, dan moet je die format er uithalen (vergeten dat mijn gls wat uitgebreider is):
Puntensaldo:
Het werkt wel, maar niet zoals ik het wil.
Ik heb voor de handigheid even een Demonstratie account aangemaakt.
Als je inlogt op www.btg4cash.nl/inloggen.php
Met:
Gebruikersnaam: Demo
Wachtwoord: Demo

En je gaat dan naar: http://btg4cash.nl/dashboard.php?p=saldo
Dan krijg je een error.
Maar ga je naar: http://btg4cash.nl/saldo.php
Dan staat er gewoon je punten saldo.
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
bij allebei de paginas staat dat ik niet ben ingelogd dus je hebt iets niet goed gedaan met de code?
0
Vandijkdesign

Lid · Topicstarter

Berichten
753
Reputatie
0
Punten
0,06
Lid sinds
Laatst gezien
Marjolein schreef:
bij allebei de paginas staat dat ik niet ben ingelogd dus je hebt iets niet goed gedaan met de code?
Eerst inloggen met de gegevens op
www.btg4cash.nl/inloggen.php
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik ben ingelogd, ben niet gek ofzo yummie
E: oh nu zie ik die error wel..

Fatal error: Call to undefined function format() in /home/vandijk/domains/btg4cash.nl/public_html/pages/saldo.php on line 15


nja, zoals ik al zei, die code veranderen, er staat nog steeds dat format bij.
0
Vandijkdesign

Lid · Topicstarter

Berichten
753
Reputatie
0
Punten
0,06
Lid sinds
Laatst gezien
Marjolein schreef:
ik ben ingelogd, ben niet gek ofzo yummie
E: oh nu zie ik die error wel..

Fatal error: Call to undefined function format() in /home/vandijk/domains/btg4cash.nl/public_html/pages/saldo.php on line 15
nja, zoals ik al zei, die code veranderen, er staat nog steeds dat format bij.

Maar dat klopt toch niet?
Want via die link van dashboard wordt gewoon saldo.php geincluded.
En toch doet die het niet.
En als ik gewoon naar saldo.php ga, doet die t wel?
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik weet niet hoe jouw pagina systeem werkt maar al mijn paginas staan in een map dus waarschijnlijk zit daar de fout?
0
Vandijkdesign

Lid · Topicstarter

Berichten
753
Reputatie
0
Punten
0,06
Lid sinds
Laatst gezien
Marjolein schreef:
ik weet niet hoe jouw pagina systeem werkt maar al mijn paginas staan in een map dus waarschijnlijk zit daar de fout?
De pagina dashboard en saldo staan in het zelfde mapje?

toevoeging op 11 april 2012, 19:01:48:
Probleem opgelost.
Ik zat heletijd de saldo.php in de public_html map te bewerken.
Terwijl de juiste natuurlijk in het mapje Pages staat..
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