ORDER BY RAND() werkt niet.

Gestart doorWashand2 reacties55 weergaven

3 berichten · pagina 1 van 1

Washand

Lid · Topicstarter

Berichten
1.909
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey One2xs,

Op mijn GPT heb ik nu enorm veel uurfans staan.
Er wordt goed op geklikt maar het probleem is dat ze op volgorde staan.
De uurfans met de minste kliks nog tegoed staan nu bovenaan. Omdat het zon enorm lange lijst is, worden dus alleen die fans veel geklikt.
Nu wil ik het veranderen dat ze dus random in de lijst staan.
Dus ik dacht aan ORDER BY RAND(), dat plaatste ik dus onder LIMIT 25 maar hij doet het dan niet.

Wat is het probleem?

[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"../_include.php"[/COLOR][COLOR= #007700]);[/COLOR]
design_boven[COLOR= #007700]([/COLOR][COLOR= #DD0000]"$naamsite - Uurfans"[/COLOR][COLOR= #007700]);[/COLOR]
check_login[COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]menu.inc[/COLOR][COLOR= #007700]);[/COLOR]    
?>
<h2>Uurfans</h2>
    

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]http_user_agent[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"AutoIt"[/COLOR][COLOR= #007700]) {[/COLOR] [URL="http://www.php.net/DIE"]DIE[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"U klikt met AutoIt, dit is niet toegestaan!!"[/COLOR][COLOR= #007700]);}[/COLOR]
              [COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
                            SELECT 
                                id, 
                                naam,
                                kliks 
                            FROM 
                                klikfans
                            WHERE 
                                kliks > 0 
                            AND 
                                id NOT IN(
                                            SELECT 
                                                id1 
                                            FROM 
                                                klikfansgeklikt
                                            WHERE 
                                                gebruikersnaam = "[/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]user[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" 
                                            AND 
                                                datum > "[/COLOR][COLOR= #007700].([/COLOR][URL="http://www.php.net/time"]time[/URL][COLOR= #007700]() -[/COLOR] [COLOR= #0000BB]3600[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]"
                                                )
                                            
                        "[/COLOR][COLOR= #007700]);[/COLOR]

    [COLOR= #0000BB]$resterend[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$resultaat[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$resterend[/COLOR][COLOR= #007700]-[/COLOR][COLOR= #0000BB]10[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$resultaat[/COLOR] [COLOR= #007700]<=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR][COLOR= #0000BB]$resultaat[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];}[/COLOR]

    
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$resterend[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) 
    {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<a href=klikfanskopen.php>Uw eigen uurfans-advertenties plaatsen.</a><br /><br />"[/COLOR][COLOR= #007700];[/COLOR]

        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<i>Er zijn geen uurfans beschikbaar.</i>"[/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]"Per klik op een uurfans advertentie krijgt u er "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$klikfan[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" fans bij.<br /> Voor een VIP lid zijn dit "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$klikfanvip[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" fans. <br />"[/COLOR][COLOR= #007700];[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br /><a href=klikfanskopen.php>Uw eigen uurfans-advertenties plaatsen.</a><br /><br />"[/COLOR][COLOR= #007700];[/COLOR]
        
?>
<script src="http://www.google.com/jsapi" type="text/javascript"></script> 
<script type="text/javascript"> 
    google.load("jquery", "1.4.2");
</script>
<script type="text/javascript"> 
    $(document).ready(function(){
        $(table#kliks tr.link).click(function() {
            $(this).css(display,none);
        });
    });
</script>

<table width=450  id=kliks>
    <tr>
        <td class=tabel width=300>
            Link
        </td>
        <td class=tabel width=75>
            Resterend
        </td>
    </tr>
[COLOR= #0000BB]<?php
        $lijst[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
                            SELECT 
                                id, 
                                naam,
                                kliks 
                            FROM 
                                klikfans
                            WHERE 
                                kliks > 0 
                            AND 
                                id NOT IN(
                                            SELECT 
                                                id1 
                                            FROM 
                                                klikfansgeklikt
                                            WHERE 
                                                gebruikersnaam = "[/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]user[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" 
                                            AND 
                                                datum > "[/COLOR][COLOR= #007700].([/COLOR][URL="http://www.php.net/time"]time[/URL][COLOR= #007700]() -[/COLOR] [COLOR= #0000BB]3600[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]"
                                                )
                                            LIMIT 25
                                                                                       
                        "[/COLOR][COLOR= #007700]);[/COLOR]
        
        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$lijst[/COLOR][COLOR= #007700])){[/COLOR]

            
?>
    <tr class="link">
        <td class="inhoud">
            <a style="font-weight:strong; font-size:12px;" href="klikfansads.php?id=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>" target="_blank">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]];[/COLOR] ?></a>
        </td>
        <td class="inhoud">
            [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]kliks[/COLOR][COLOR= #007700]];[/COLOR] ?>
        </td>
    </tr> 
[COLOR= #0000BB]<?php[/COLOR]
            [COLOR= #007700]}[/COLOR]        
                
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</table><br />"[/COLOR][COLOR= #007700];[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<a href=klikfans.php>Nog $resultaat nieuwe uurfans te klikken.</a><br /><br />"[/COLOR][COLOR= #007700];
        
                
    }[/COLOR]

design_onder[COLOR= #007700]([/COLOR][COLOR= #DD0000]1[/COLOR][COLOR= #007700]);[/COLOR]
?>
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je hebt altijd eerst ORDER BY en dan LIMIT.
0
Washand

Lid · Topicstarter

Berichten
1.909
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Thx opgelost
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